Saturday, April 17, 2010

Help please! Visual Basic 6.0?

Lions, Tigers, and Bears pet clinic is impressed with your previous work for them and have hired you for another small project. The vet assistants would like an application that displays basic services. The application should be designed with check boxes to select the various such as office calls, vaccinations grooming, hospitalization, heartworm preventative....etc. After all the selections have been made,t he charges should be added together to arrive at a total amt. due and siplayed when a CommandButton control is clicked. if the patient's owner thinks the total is too high, a way to clear the CheckBox controls, the corresponding service chargest, and the total amt. to begin selecting again should be avail.





This is what I have so far:





Command1.Caption = (Val(Check1.Value) + Val(Check2.Value))





If Check1.Value = 1 Then lblAmtdue.Caption = 50


If Check2.Value = 1 Then lblAmtdue.Caption = 100


......etc.


lblAmtdue.Caption = ""





What code should I use? Please help!!!

Help please! Visual Basic 6.0?
Command1.Caption is the text on the button named Command1, not values from the program. It should tell the user what happens when s/he clicks it - like Add, Enter, Quit.





If Check1 is a check box, the value is either vbChecked or vbUnchecked, not the value in some other control.





You should use VB's constants wherever possible:





If Check1.Value = vbChecked Then





Add the values up - If Check1 is checked, it's 50, if Check2 is checked it's 100, but if both are checked it should be 150, right? With your code it will be 100.





Then, after you get all the values, you wipe them out with





lblAmtdue.Caption = ""


No comments:

Post a Comment