Gil
2009-03-09 23:03:06 UTC
Hi
I'm making a little program but i have a problem with code, don't know
what's going on, the user select an option, but doesn't work
the code is the following
Public Class Form1
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim id, peso, alt, rst As Double
id = Val(TextBox3.Text)
peso = Val(TextBox2.Text)
alt = Val(TextBox1.Text)
rst = peso / alt ^ 2
Label7.Text = FormatNumber((rst), 2)
If ComboBox1.SelectedText = "Adulto" Then
If Label7.Text < 18 Then
Label6.Text = "Está abaixo do peso normal"
ElseIf Label7.Text < 25 Then
Label6.Text = "Está no peso normal"
ElseIf Label7.Text > 25 Then
Label6.Text = "Está acima do normal"
End If
ElseIf ComboBox1.SelectedText = "Criança" Then
If Label7.Text < 18.3 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Green
Label6.Text = "Está normal"
Label8.Text = "Percentil P85"
ElseIf Label7.Text < 19.1 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Yellow
Label6.Text = "Pode perder um pouco de peso"
Label8.Text = "Percentil P90"
ElseIf Label7.Text < 20.6 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Orange
Label6.Text = "Está com sobre peso, emagreça"
Label8.Text = "Percentil P95"
ElseIf Label7.Text > 21.9 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Red
Label6.Text = "Está obeso, emagreça urgentemente"
Label8.Text = "Percentil P97"
End If
End If
End Sub
End Class
any help please?
Thanks
I'm making a little program but i have a problem with code, don't know
what's going on, the user select an option, but doesn't work
the code is the following
Public Class Form1
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim id, peso, alt, rst As Double
id = Val(TextBox3.Text)
peso = Val(TextBox2.Text)
alt = Val(TextBox1.Text)
rst = peso / alt ^ 2
Label7.Text = FormatNumber((rst), 2)
If ComboBox1.SelectedText = "Adulto" Then
If Label7.Text < 18 Then
Label6.Text = "Está abaixo do peso normal"
ElseIf Label7.Text < 25 Then
Label6.Text = "Está no peso normal"
ElseIf Label7.Text > 25 Then
Label6.Text = "Está acima do normal"
End If
ElseIf ComboBox1.SelectedText = "Criança" Then
If Label7.Text < 18.3 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Green
Label6.Text = "Está normal"
Label8.Text = "Percentil P85"
ElseIf Label7.Text < 19.1 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Yellow
Label6.Text = "Pode perder um pouco de peso"
Label8.Text = "Percentil P90"
ElseIf Label7.Text < 20.6 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Orange
Label6.Text = "Está com sobre peso, emagreça"
Label8.Text = "Percentil P95"
ElseIf Label7.Text > 21.9 And id = "8" Then
Label6.Text = FontStyle.Bold
Label6.ForeColor = Color.Red
Label6.Text = "Está obeso, emagreça urgentemente"
Label8.Text = "Percentil P97"
End If
End If
End Sub
End Class
any help please?
Thanks
--
GMC
GMC