Posts Tagged ‘Label’

5.1 Checking/Validating data using IF Statements in Visual Basic.NET

July 23, 2009 - 5:18 pm 3 Comments

Using an IF Statement to Validate text placed in a text box on button press:

Here’s the code I used in this:

Dim Captain As String

Captain = TextBoxCaptain.Text
Captain = Captain.ToUpper

If Captain = “PICARD” Or Captain = “KIRK” Or Captain = “ARCHER” Or Captain = “PIKE” Or Captain = “JANEWAY” Then

MsgBox(”Indeed, Warp Factor 9!”)
Else
MsgBox(Captain & ” has never been a Captain”)
End If

Have fun!

Duration : 0:7:25

(more…)