I kinda Suck big time at Program. I'm a more hands on,
but anyway i'm trying to get a simple Program up and running..
Its a Calorie Counter.
What i have is 2 Input text boxes 2 Labels and one label to Display the message and the % of Fat
and 3 Buttons Go, Clear, Exit.
at the Moment i have;
Code:Dim Textbox1 As String = "" Dim TextBox2 As String = "" Dim lblDisplay As String = "" Dim Temp As String Dim Label3 As Integer Const dblCalories = 9 Const dblfat = 1 Do Textbox1 = (" ") If IsNumeric(Temp) = False Then MessageBox.Show("Please enter a number!") End If Loop While IsNumeric(Temp) = False If dblfat < 30 Then Label3.caption("Health Verdict Eat Away, this is a low fat healthy option") End If If dblfat > 30 OR <70 Then Label3.caption("Alright, it won’t kill you but you could choose a lower fat alternative!") End If If dblfat > 70 Then Label3.caption("Are you trying to kill yourself? This food is very fattening") End If End Sub
The "If dblfat > 30 OR <70 Then" for some reason is coming up in Red the < 70 Then part that is.
my maths are something like
Percentage of calories from fat = Calories from fat/Total Calories
What code do i need to get the LblDisplay show The Message of what ever the out come of dblfat is?
Am i declaring the Text boxes rightly?




Reply With Quote