Wednesday, September 29, 2010

Wednesday, September 29 2010

I'm still looking at the tutorials Evangelos Petroutsos wrote, they are quite good.

I'd like to finish the tutorials by Halverson in his book Visual Basic 2005 Step by Step Overall I've really liked his tutorials. I think it would be good to finish a book in the near future.

Here is a quick example tutorial from Petrousos



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim password As String, ch As Char
Dim i As Integer
Dim valid As Boolean = False
While Not valid
password = InputBox("Please enter your password.")
For i = 0 To password.Length - 1
ch = password.Chars(i)
If Not Char.IsLetterOrDigit(ch) Then
valid = True
Exit For
End If
Next
If valid Then
MsgBox("Your new password will be activated immediately!")
Else
MsgBox("Your password must contain at least one special symbol!")
End If
End While
End Sub
End Class


I also made up my own small program using as an assignment from the Petroutsos book.



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim firstName(4) As String
Dim lastName(4) As String

For i = 1 To 5
firstName(i + 1) = InputBox("Please enter the first name.")
lastName(i + 1) = InputBox("Please enter the last name.")
txtDisplay.Text = txtDisplay.Text + firstName(i + 1) & " " & lastName(i + 1) & vbCrLf
Next i
End Sub

No comments: