VB.net Help

Status
Not open for further replies.

rjsdabom

Member
Original poster
member
Joined
Jul 20, 2011
Posts
22
Reaction score
0
Points
0
Hey guys, i am a noob at vb.net, and i was wondering how i would make it so if both textboxes werent filled out a messagebox would tell to fill both out. This is an easy +rep and thanks. Thanks
 

Flip

Old School
old school
member
Joined
Jul 23, 2009
Posts
263
Reaction score
69
Points
108
I'm not very familiar with VB.NET syntax so bear with me.

Code:
If MyTextBox.Text.Length == 0 Then
//messagebox or whatever you want
End If

You could also use

Code:
MyTextBox.Text = String.Empty

or

Code:
MyTextBox.Text = ""

but length is probably the easiest.
 
  • Like
Reactions: rjsdabom

Aristide

Old School
old school
member
Joined
Apr 29, 2011
Posts
1,843
Reaction score
215
Points
158
Location
Milan, Italy
by what prarie dog said, easier;
Code:
If MyTextBox.Text.Length == 0 Then
MsgBox("Puttexthere")
End If

thank me or prarie dog lol ;)
 
  • Like
Reactions: rjsdabom

Lightness

Banned
Joined
Jul 5, 2011
Posts
6,514
Reaction score
1,773
Points
0
Location
SF Bay Area
If Textbox1.text = nothing and textbox2.text = nothing then
msgbox("fill in both fields.", msgboxstyle.information)
end if
 
  • Like
Reactions: rjsdabom

rjsdabom

Member
Original poster
member
Joined
Jul 20, 2011
Posts
22
Reaction score
0
Points
0
Thanks guys!
 
K

KamaluNg

Guest
The answer is:

If textbox1.text = "" then
Msgbox("TypeHere")
Elseif textbox2.text = "" then
Msgbox("TypeHere")
Else
Your next step here.... :D
End if
 
D

DTD

Guest
The answer is:

If textbox1.text = "" then
Msgbox("TypeHere")
Elseif textbox2.text = "" then
Msgbox("TypeHere")
Else
Your next step here.... :D
End if

he already got 4 answers or something, no need for another one.
 
Status
Not open for further replies.