I already put the input for weight and height, and the message comes out. I want to make try catch for age too, its for integer, and the system knows that it is from age.
For example, I input age = "k" . then messagebox will say "wrong input for age". then when I input for weight neither height = "a" . then messagebox will say "wrong input height" or "wrong input weight" or "wrong input hiehgt and weight"
How to like that exception?
Private Sub ButtonCalculate_Click(sender As Object, e As EventArgs) Handles ButtonCalculate.Click
Dim peopleName As String
Dim peopleAge As Integer
Dim peopleWeight As Double
Dim peopleHeight As Double
Dim peopleBMI As Double
If Me.TextBoxWeight.Text <> "" Or Me.TextBoxHeight.Text <> "" Or Me.TextBoxAge.Text <> "" Then
Try
Me.peopleWeight = Double.Parse(Me.TextBoxWeight.Text)
Me.peopleHeight = Double.Parse(Me.TextBoxWeight.Text)
Me.peopleAge = Integer.Parse(Me.TextBoxAge.Text)
Catch
'this one is for weight/height
MessageBox.Show("Wrong Input for Weight and Height", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
'Catch for age is here?
End Try
End If
End Sub