The attached code shows a simple form with one text box and one button to enter a name and to show a welcome message when the button is clicked.
It works okay but sometimes errors at the End command at line marked by '*********
The code was created using vs2008 and I am running it in vs2010.
Question1: Is this command (End)no longer valid in vs2010?
Error: Win32Exception was unhandled; Error creating window handle
Public Class frmWelcomeStudent
Private Sub cmdWelcome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdWelcome.Click
Dim intResponse As Integer
Dim strMsg As String
Dim strTitle As String
Dim strName As String
'store student name after triming the blank spaces either side
strName = Trim(txtUserName.Text)
'check to see if user name is left blank
If Len(strName) = 0 Then
MessageBox.Show("Please enter a name.", "User Name Is Blank...")
'check to see at least the first char is "A" thru "z"
If strName.Substring(0, 1) >= "A" And strName.Substring(0, 1) <= "z" Then
strMsg = "Welcome to CS 19 '" & strName & "'." & vbNewLine & vbNewLine & _
"Do you want to exit?"
strTitle = "Message To Student..."
intResponse = MessageBox.Show(strMsg, strTitle, MessageBoxButtons.YesNo, _
If intResponse = vbYes Then
MessageBox.Show("Please enter a name starting with a letter.", "User Name '" & _
strName & "' Not Valid...")
You probably recall while back I was looking to simulate a fuel gauge:
Drive 60 miles
Gas use 30 miles/gal
Fuel gauge shows 15 Gal.
Upon a click on "Drive" button, the indicator arm swings from 15 down to 13 gal.
Later on, to make it more complex, one can add velocity parameter for the fuel gauge operate like an analog instrument. But that is for much later.
Recently I took some Java course and did a similar animation (simulation). But with this fuel gauge I will need you help. I also am about to start a database development job so I will be able to visit your profile often.