Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CODING ON VB 1

Status
Not open for further replies.

JHTEX1

Programmer
Sep 11, 2001
3
US
coding
Question: I have creaded a form with 3 lables and each one with its respected text box. I also included 2 control buttons, one that reads calculate and one that reads clear.
I have to start writing the code for the following:
based on number of hours (txthours.text) and pay rate (txtrate.text) calculate the total pay by clicking the (cmdCalculate) button and placing the result in the total pay (txttotal.text) box.

I could do that, but my problem would be if I have overtime.....houw do I integrate that into the code.
Thanks for your help.
JR
 
You'll need to know the overtime rate, which will require another textbox.

So far as calculating this, write down the algebraic formula for doing this, and replace the elements with the names of the appropriate text box.

Here's a tip for getting the tab order correct for your labels, textboxes, and button. Right-click on an empty spot on the form and choose "Lock Controls". Then left-click on each control in reverse order, and set the tab order property value to 0. When you get done, the control you want to have the cursor appear in first will have tab order 0 (which means it gets the cursor first), and the control you want the user to fill in last will have the highest tab order value.

If you have label & textbox combinations, you should click on the textbox first, then the label. If the label has an accelerator key (use the '&' character to set this .. like in "&Calculate"). So when the user presses the letter corresponding to the accelerator letter ("C" in this case), focus will move to the label, but since labels can't have the focus, it will be bounced to the control next-highest in the tab order list, which will be the adjacent textbox. Magic!

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top