vb.net - How to check whether an input is numeric or not in multiple TextBoxes? -


i working on exam in programming using vb, , trying make 2 subs text input , numeric values. code 1 textbox easy, cant seem remember how multiple textboxes use sub call if sentence up. (i use handles textchange in vb control input)

here code used checking 1 textbox:

if not regex.match(txtregansnr.text, "^[a-å]*$", regexoptions.ignorecase).success  msgbox("kun bokstaver tillatt.", , "feil")         txtregansnr.clear()         txtregansnr.focus()  end if 

i have tried modify code cant work want to.

put inside textchanged event handler:

dim txtbox textbox = directcast(sender, textbox)  if not regex.match(txtbox.text, "^[a-å]*$", regexoptions.ignorecase).success    msgbox("kun bokstaver tillatt.", , "feil")   txtbox.clear()   txtbox.focus()  end if 

append textboxes handles list of above handler:

sub textchanged(sender object, e system.eventargs) handles txtregansnr.textchanged, txtbox1.textchanged, txtbox2.textchanged, ... 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -