Page 1 of 1
VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 6:17 pm
by codedrive
Hey #
code it and #codedrive (me) are working on a project where you register! We need to know wuts the code to check if a textbox contains text, i thought
Code: Select allIf textbox.text.contains letters then
but it's not working! we have 5 textbox's and we need it all in one If!
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 6:34 pm
by DeveloperJacob
Try this:
Code: Select allIf not textbox.text = nothing then
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 6:39 pm
by AnoPem
codedrive wrote:Hey #code it and #codedrive (me) are working on a project where you register! We need to know wuts the code to check if a textbox contains text, i thought
Code: Select allIf textbox.text.contains letters then
but it's not working! we have 5 textbox's and we need it all in one If!
what about
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 6:51 pm
by muttley1968
Wrote in browser soo might be alittle off but this should work
Code: Select alldim I as textbox in me.controls
if type of I.text.contains = "1" then
'do something
end if
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 7:39 pm
by Filip
Code: Select allIf TextBox1.Text <> Nothing Then
'Textbox contains something
Else
'Textbox is empty
End If
Or
Code: Select allIf TextBox1.text.lenght = 0 Then
'Textbox is empty
else
'Textbox contains something
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 9:17 pm
by Matt
try
Code: Select allif textbox.text = "" then
msgbox"text box does not contain any text"
as an example.
This has always helped me out.
+rep if I helped you :-)
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 9:29 pm
by codedrive
I need it like i have 5 textbox's! I need on
If
End If
so it can check first to see if there all filled out then if its right it does a code :?
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 9:33 pm
by bisnes_niko
Code: Select all If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox("some are empty")
Else
MsgBox("none of them are empty")
'continue registration...
End If
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Sun Aug 19, 2012 9:37 pm
by codedrive
bisnes_niko wrote:Code: Select all If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then
MsgBox("some are empty")
Else
MsgBox("none of them are empty")
'continue registration...
End If
I also need it to check a textbox would i use this code
so i have the or's
,,,,,, And CaptchaConfirm.text=Captchacode.text , Would i use that to check if a code was entered right? THX to #MrAksel for Captcha system
Re: VB.NET Help - Checking If Textbox Contains Text
Posted: Mon Aug 20, 2012 12:31 pm
by MrAksel
Code: Select allIf (TextBox1.Text + TextBox2.Text + TextBox3.Text + TextBox4.Text + TextBox5.Text).Contains("letters") Then
End If
And yes, you would be able to check if the captcha is correct your way.