How To: Use IF Statements in Visual Basic 2005 & 2008

Use IF Statements in Visual Basic 2005 & 2008

In this Visual Basic tutorial, you'll learn to use conditional statements for the push-button validation of a designated text string. The code used in this example is as follows:

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

For complete, step-by-step instructions on using IF statements in your own Visual Basic 2005 and 2008 Studio projects, watch this how-to.

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Be the First to Comment

Share Your Thoughts

  • Hot
  • Latest