Discussion:
Problem with code
(too old to reply)
Gil
2009-03-09 23:03:06 UTC
Permalink
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
--
GMC
Mahmoud Ghoz |
2009-03-10 02:03:50 UTC
Permalink
Hello Gil,
is this windows or web forms?

also i suggest that you repost your question on the correct chanel to be
sure that your question been answered.

Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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?
Thank
Gil
2009-03-10 14:27:04 UTC
Permalink
Hi

Windows form
Where is the correct chanel??

Thanks
Post by Mahmoud Ghoz |
Hello Gil,
is this windows or web forms?
also i suggest that you repost your question on the correct chanel to be
sure that your question been answered.
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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
Mahmoud Ghoz |
2009-03-11 00:23:51 UTC
Permalink
Hello Gil,
can you send me the code attached, as I can't understand the exact problem.

The thread you should use is microsoft.public.dotnet.framework.windowsforms.
But let's complete this one here.

Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
Hi
Windows form
Where is the correct chanel??
Thanks
Post by Mahmoud Ghoz |
Hello Gil,
is this windows or web forms?
also i suggest that you repost your question on the correct chanel to
be sure that your question been answered.
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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?
Thank
Gil
2009-03-12 14:43:54 UTC
Permalink
Hi mate

Thanks for your help
The problem is no sentences appear for example, choosing the first option
"Adulto" if the label7.text <18, the label6.text must show "Est? abaixo do
peso normal", and the rest is below

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

The text in label6.text never appear
hope the explanation is enought, lol

Thanks


"Mahmoud Ghoz |" <www.ghoz.net> escreveu na mensagem news:***@msnews.microsoft.com...
Hello Gil,
I dont know what is wrong with your application, i try to open your solution
but i fails, i have moved your files into another project, and everything
looks fine to me.

I have attached the solution i create along. can you tell me exactly what is
your problem?


Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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
unknown
2009-03-13 00:11:01 UTC
Permalink
Hello Gil,
You want to change this "ComboBox1.SelectedText" to be "ComboBox1.Text".

One other comment try to avoid naming the label by label1, label2 ... etc
... you should name all your control in a meaningful names to be easy to
debug.

tell me the results.
Thank you

Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
Hi mate
Thanks for your help
The problem is no sentences appear for example, choosing the first option
"Adulto" if the label7.text <18, the label6.text must show "Est? abaixo do
peso normal", and the rest is below
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
The text in label6.text never appear
hope the explanation is enought, lol
Thanks
Hello Gil,
I dont know what is wrong with your application, i try to open your solution
but i fails, i have moved your files into another project, and
everything
looks fine to me.
I have attached the solution i create along. can you tell me exactly
what is your problem?
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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 followin
Gil
2009-03-13 00:52:08 UTC
Permalink
Hi Mahmoud

Thanks
It works fine now, it was the ComboBox.selected text.
Thanks again mate

regards
Post by Mahmoud Ghoz |
Hello Gil,
You want to change this "ComboBox1.SelectedText" to be "ComboBox1.Text".
One other comment try to avoid naming the label by label1, label2 ... etc
... you should name all your control in a meaningful names to be easy to
debug.
tell me the results.
Thank you
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
Hi mate
Thanks for your help
The problem is no sentences appear for example, choosing the first option
"Adulto" if the label7.text <18, the label6.text must show "Est? abaixo do
peso normal", and the rest is below
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
The text in label6.text never appear
hope the explanation is enought, lol
Thanks
Hello Gil,
I dont know what is wrong with your application, i try to open your solution
but i fails, i have moved your files into another project, and everything
looks fine to me.
I have attached the solution i create along. can you tell me exactly
what is your problem?
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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
Mahmoud Ghoz |
2009-03-13 02:58:05 UTC
Permalink
Hello Gil,
You are welcome :) ... anytime ... feel free to contact me.

Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
Hi Mahmoud
Thanks
It works fine now, it was the ComboBox.selected text.
Thanks again mate
regards
Post by Mahmoud Ghoz |
Hello Gil,
You want to change this "ComboBox1.SelectedText" to be
"ComboBox1.Text".
One other comment try to avoid naming the label by label1, label2 ...
etc ... you should name all your control in a meaningful names to be
easy to debug.
tell me the results.
Thank you
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
Hi mate
Thanks for your help
The problem is no sentences appear for example, choosing the first option
"Adulto" if the label7.text <18, the label6.text must show "Est? abaixo do
peso normal", and the rest is below
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
The text in label6.text never appear
hope the explanation is enought, lol
Thanks
Hello Gil,
I dont know what is wrong with your application, i try to open your solution
but i fails, i have moved your files into another project, and everything
looks fine to me.
I have attached the solution i create along. can you tell me exactly
what is your problem?
Mahmoud Ghoz
www.Ghoz.NET
Post by Gil
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 followin
Loading...