I have to develop a case logic and validate text box control so it is not empty.
I need to validate a name TextBox control so that it is not empty in which an error message will be displayed, and set the focus back to the name's control. I must use a Case Logic that when a city is typed in, the county shows in the Textbox entry. For example "mentor" will be "lake" county. This is for my class, I have read the instructor's examples and read the chapter. I am still having trouble under standing the Case Logic. Here is the code that I have so far. Thanks guys I will even give you reputation and credit for my work. Thanks. How do I get it to pop up the error message if another button is clicked before the name's TextBox is entered?
Public Class Form1
Private Sub PatientTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PatientTextBox.TextChanged
If PatientTextBox.TextLength = 0 Then
MessageBox.Show("Please input the patient's name to proceed.", "ErrorMessage")
ElseIf PatientTextBox.Text = "" Then
PatientTextBox.Text = PatientTextBox.ToString
End If
End Sub
Private Sub TeenRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TeenRadioButton.CheckedChanged
If TeenRadioButton.Checked = True Then
AgeTextBox.Text = "Teenager"
ElseIf YoungAdultRadioButton.Checked = True Then
AgeTextBox.Text = "Young Adult"
End If
End Sub
Private Sub MidAgeRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MidAgeRadioButton.CheckedChanged
If MidAgeRadioButton.Checked = True Then
AgeTextBox.Text = "Middle Age Person"
ElseIf SeniorRadioButton.Checked = True Then
AgeTextBox.Text = "Retirement Age"
End If
End Sub
Private Sub CountyTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CountyTextBox.TextChanged
Select Case CityTextBox.Text
Case "Mentor"
Case "Kirtland"
Case "Painesville"
Case "Euclid"
End Select
Select Case CountyTextBox.Text
Case "Lake"
Case "Lake"
Case "Lake"
Case "Cuyahoga"
End Select
End Sub
End Class
Last edited by BMan8577; 09-23-2011 at 07:58 AM.
|