Intro+to+Computer+Programming

This course introduces computer programming using Microsoft Visual Basic. Topics covered include an overview of the history of programming languages, VB's Integrated Development Environment, graphical user interfaces, variables, methods, calculations, decision-making, repeating program insturctions, and functions.
 * Welcome to Introduction to Computer Programming **



Cut and paste this code into the click event of your Palindrome button:

Dim tmpstr As String

Dim leftchar, rightchar As Integer

Dim palindrome As Boolean

tmpstr = TextBox1.Text leftchar = 0 'Convert tmpstr to all upper case. Otherwise "Anna" will not be

'detected as a palindrome.

' Set rightchar equal to the index of the last character

' of the string. Remember, the first character of the string

' has an index of 0.

palindrome = True

Do While rightchar > leftchar leftstr = tmpstr.Substring(leftchar, 1) 'set rightstr equal to the position in tmpstr that we want to

'check on the right.

If leftstr <> rightstr Then

palindrome = False

End If

'Update leftchar and rightchar to move to next character of

'the string that we want to check.

Loop

If palindrome Then

OutputLabel.Text = "String is a palindrome."

Else

OutputLabel.Text = "String is NOT a palindrome."

End If



Images for Rock, Paper, Scissors: