Re: Food Project

  • From: "Marvin Hunkin" <startrekcafe@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 14 Oct 2008 12:04:39 +1100

    Hi.
sorry to update and forgot to do that.
forgot a else keyword and now it works.
thanks for all your help.
now, cheers Marvin.
ps: now my problems and errors are with binding database fields to text 
boxes, combo  boxes, check boxes, and do i need to create text boxes, or can 
the database wizard do that for vb.
and also, the vwd and the issues i have been having with not liking the 
fonts, in a table, and also missing a :s, and also my drop down list box, 
giving me a system,row number.
so if any one can help out would be appreciative.
----- Original Message ----- 
From: "Bob J." <rjustice004@xxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, October 14, 2008 2:42 PM
Subject: Re: Food Project


Marvin,

If the trapped error specifically identifies the
IsNumeric(tbGramsOfProteinTextBox.Text) function call then I would suspect
the declaration/definition of the tbGramsOfProteinTextBox.

hth

Bob




----- Original Message ----- 
From: "Charles E. Black" <charlesblackusc@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, October 13, 2008 3:40 PM
Subject: RE: Food Project


Use a validation control.

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Marvin Hunkin
Sent: Monday, October 13, 2008 6:16 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Food Project

Hi.
well, doing a project and will copy the project description below, and then
discuss my question and problem, with a little bit of my code problem.

here's the project description:

3.1 Create a project that calculates the total of fat, carbohydrate, and
protein
calories. Allow the user to enter (in text boxes) the grams of fat, the
grams
of carbohydrates, and the grams of protein. Each gram of fat is nine calo-
ries; a gram of protein or carbohydrate is four calories.
Display the total calories for the current food item in a text box. Use
two other text boxes to display an accumulated sum of the calories and a
count of the items entered.
Form: The form should have three text boxes for the user to enter the
grams for each category. Include labels next to each text box indicating
what the user is to enter.
Include buttons to Calculate, to Clear the text boxes, and to Exit.
Make the form's Text property "Calorie Counter".
Code: Write the code for each button. Make sure to catch any bad input
data and display a message box to the user.


my question is:


how do i fix the vallidation for is numeric.

you enter the grams of fat, cars and rpteinprotein.
then you click calculate and it shows you the total calories, the
accumulated amount of calories and the number of items entered.
now, got a is numeric test for fat, carbs and protein.
but it gives me a error, and traps the protein is numeric function.
so how do i fix it, so it does not pop up the message, when i input valid
data?

so here's the code segment.

        If IsNumeric(tbGramsOfFatTextBox.Text) Then
            intGramsOfFatEnteredInteger = CInt(tbGramsOfFatTextBox.Text)
        else
                   MessageBox.Show("You Did Not Enter Grams Of Fat.", "Data
Error", _
                            MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
            tbGramsOfFatTextBox.Focus()
            Return

        End If

if IsNumeric(tbGramsOfCarbohydratesTextBox.Text) Then
            intGramsOfCarbsEnteredInteger =
CInt(tbGramsOfCarbohydratesTextBox.Text)
else
messageBox.Show("You Did Not Enter Grams Of Carbohydrates.", "Data Error", _
messageBoxButtons.Ok, messageBoxIcon.Exclamation)
            tbGramsOfCarbohydratesTextBox.Focus()
return


        End If

         ' If IsNumeric(tbGramsOfProteinTextBox.Text) Then
        intGramsOfProteinEnteredInteger = CInt(tbGramsOfProteinTextBox.Text)
                             ' MessageBox.Show("You Did Not Enter Grams Of
Protein.", "Data Error", _
                             'MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
             ' tbGramsOfProteinTextBox.Focus()
             ' Return

         ' End If

and had to comment it out, so it would not keep falling over.
sorry for the long explanation, but had to explain myself, so you could
understand the problem.
cheers Marvin.


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: