vb.net - how to show a error when the textbox is empty -


how show error when textbox empty

private sub button1_click(sender object, e eventargs) handles button1.click     dim numofmon integer     numofmon = textbox4.text     if textbox4.text = ??         messagebox.show("error")      end if end sub 

please help

you trying parse integer value, better cheking if textbox text empty, directly should call integer.tryparse function evaluate whether text, emptyness or not, translated integer value.

dim numofmon integer  if not (integer.tryparse(textbox4.text, numofmon))     messagebox.show("error")  else     ' logic here...  end if 

note numofmon passed refference, if integer.tryparse success assigns value given variable.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -