CODE
Private Sub BtnGrade_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGrade.Click
Dim s1, s2, s3, s4, s5 As Integer
Dim grade As String
Dim average As Double
Dim isconverted As Boolean
isconverted = Integer.TryParse(TxtS1.Text, s1)
isconverted = Integer.TryParse(TxtS2.Text, s2)
isconverted = Integer.TryParse(TxtS3.Text, s3)
isconverted = Integer.TryParse(TxtS4.Text, s4)
isconverted = Integer.TryParse(TxtS5.Text, s5)
If isconverted = True Then
average = (s1 + s2 + s3 + s4 + s5) / 5
grade = LblGrade.Text
Select Case average
Case Is <= 70
grade = "Tiger"
Case 70 To 74
grade = "Pro"
Case 75 To 90
grade = "Want to Be"
Case Is >= 90
grade = "Duffer"
End Select
LblGrade.Text = grade.ToString()
Else
MessageBox.Show("Wrong Information entered", "Quizz4", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
End If
End Sub
Private Sub BtnClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnClear.Click
TxtS1.Text = ""
TxtS2.Text = ""
TxtS3.Text = ""
TxtS4.Text = ""
TxtS5.Text = ""
LblGrade.Text = ""
End Sub
End Class
Hello, this is my problem: need to validated allthis texboxes so it display a message box when no numeric value is inserted in one of the texboxes.
Do i need to use the isnumeric Method, for each of the texboxes..
thnaks
*ALWAYS use code blocks
This post has been edited by PsychoCoder: 30 Sep, 2007 - 05:20 PM