I need help with my project!



Read and add posts to the Visual Basic 6.0 Forums

Download some of my programs and OCXs

Read the Tips here

The old style forum is still available here




From: Erik
Date: Monday 25 February 2002 9:03 AM
Subject: I Need Help
Question: I am new to visual basic 6.0 and kinda behind in my class, and am having trouble coding this application.

Scenario: IMY Industries needs an application that their personnel clerks can use to calculate the new hourly pay, given the current hourly pay for each or three job codes and the raise percentage (entered as a decimal). They also want to display the message "Raise percentage: XX" on the screen. The XX in the message should be replaced by the actual raise percentage, formatted to percent.

a. Open the Lb4 (Lb4.vbp) project, which is located in the Tut03 folder on your Student Disk.
b. Save the form and the project as lb4Done in the Tut03 folder on your Student Disk.
c. Use the Properties window to verify that the New Hourly Pay button is the default button.
d. Code the Exit button so that it ends the application when it is clicked.
e. Code the Print button so that it prints the form when it is clicked. Send the focus to the Job Code 1 text box.
f. Use the InputBox function to prompt the personnel clerk to enter the raise percentage at the beginning of the application; in other works, when he or she runs the application. The raise percentage will be used to calculate the new hourly pay for each job code. (You may want to refer to this tutorial's Debugging section for hints on using the InputBox function.)
g. Use the pseudocode shown in Figure 3-36 to code the New Hourly Pay button. Assign the "Raise percentage: " message to a constant. Format the new hourly pays to standard. Format the raise rate (in the message) to percent.

Figure 3-36. New Hourly Pay Button.

1. Declare variables and constant
2. Assign values to variables
3. Calculate new hourly pay = current hourly pay * raise rate + current hourly pay
4. Display new hourly pay in appropriate label control
5. Display message and raise rate in lblMsg control
6. Send the focus to the Print button

h. Save and run the application. Enter the following information. (Enter the raise percentage when prompted by the InputBox function. Enter the current hourly pay for each job code in the appropriate text boxes.)

Raise percentage (in decimal form): .05
Job Code 1's current hourly pay: 5
Job Code 2's current hourly pay: 6.50
Job Code 3's current hourly pay: 8.75

i. Calculate the new hourly pay, then print the form with the test data showing.
j. Click the Exit button to end the application.
k. Print the code.
l. Modify the application's code so that it asks the personnel clerk to enter the raise for each job code separately. Remove the InputBox function from the form's Load event. Replace it with three InputBox functions in the New Hourly Pay button's Click event.
m. Change the message so that each rate appears on a separate line in the label control as follows:

Job Code 1: XX%
Job Code 2: XX%
Job Code 3: XX%

Assign each message to a constant.
n. Format the current hourly pay and the new hourly pay to standard.
o. Save the form and the project as lb4Done2 in the Tut03 folder on your Student Disk, then run the application. Enter the following information:

Job Code 1's current hourly pay: 5
Job Code 2's current hourly pay: 6.50
Job Code 3's current hourly pay: 8.75

p. Click the New Hourly Pay button, then enter the following information:

Job Code 1 raise percentage: .03 (The decimal equivalent of 3%.)
Job Code 2 raise percentage: .05 (The decimal equivalent of 5%.)
Job Code 3 raise percentage: .045 (The decimal equivalent of 4.5%.)

q. Print the form with the test data showing, then click the Exit button to end the application.
r. Print the code.
s. Submit the printouts from steps i and q, and the code from steps k and r.

I hope the following answers help you, but I'm can't be sure unless I see the actual project:

c. Change the Default property to True.
d. The code for this is:

Unload Me

e. The code to print the form is:


To set focus to a textbox, use this code:


f. The code for an InputBox is:

Dim s As String
s = InputBox("Prompt", "[Title]", "[Default]") 'Title and Default are optional
If s <> "" Then
End If

g. 3.

hourlypay = currenthourlypay * (raiserate + currenthourlypay)


Label1.Caption = hourlypay


lblMsg.Caption = "Raise rate: " & raiserate



m. To seperate lines:

Label1.Caption = "Job Code 1: XX%" & vbCrLf & "Job Code 2: XX%" & vbCrLf & "Job Code 3: XX%"

Archived Comments

From: Treva
Date: Friday, November 3, 2006 at 20:59:48
Comments: *this hides all the command buttons and then prints the form*

Private Sub_cmdPrint()
cmdPrint.visible = false
cmdPrint.visible = true
End Sub

From: BlackFox
Date: Friday, July 7, 2006 at 03:23:29
Comments: My Name Is Alaa , From Egypt
I Love Always To Help VB Programers To Get Stronger Because I Used To Program With Old Basic :'( When I Was Kid , Followed It With VB , And I Respect This Language Programers Too Much , And Always Feel Proud With Thier Exitance , I Always Was Facing Problems With My Old Age Professors In My College(Computer Science ) Because They Was Saying Shit About VB And Think That Only Old Staff Like C++ & Pascal Is A Real Programming Language , As I Said I Am Ready To Aid Any Body Like Language And For Free , With One Condition , Please Dont Ask Me To Make A Program For U , JUst Ask Me How To Program It
When Need Mail Me With Comment That U Are From Here Guys :
From: kike
Date: Tuesday, May 30, 2006 at 23:16:51
Comments: Same comment as Phil. Drawing histograms with lines doesn't work when using the Printform command. I would appreciate very much any suggestions for printing such forms. Thank you.
From: Phil
Date: Monday, December 27, 2004 at 15:56:34
Comments: The PrintForm command is useful, but it doesnt print out the graphics i draw onto the form

i am drawing histograms with lines and BF graphics, but they do not print

From: Mukesh
Date: Monday, December 13, 2004 at 04:56:31
Comments: If any body need help from me I m availabe free of cost. Send your projects to me I shall do programming for you.
From: ahmed
Date: Sunday, January 18, 2004 at 00:37:35
Comments: my name is Ahmed from Pakistan and I also visual basic programmer and i would like to friendship with you please inform me can u friendship with me because I proud of this website really iam very empress you .
                         Thankx to you
From: Nelly
Date: Friday, January 2, 2004 at 00:31:15
Comments: Need help with 3 projects. I will pay you to do the projects. I would like to send them to you or email them.


Reply: What projects do you need help with?
From: John
Date: Thursday, December 11, 2003 at 15:44:09
Comments: The print help was really great! But am havin trouble saving files?
From: Damien Enos
Date: Saturday, November 15, 2003 at 05:49:28
Comments: If anyone needs help with any VB stuff just send me a copy of your form and we'll talk about it! Also I can help with your html problems!
From: wajahat mirza
Date: Tuesday, November 11, 2003 at 01:03:39
Comments: hello sir
           nice to see ur site i also want to do a project in VB6.0 .but not at very high level so plz help me and guide me on this project .
                                       i shall be thanks full to you   best regard (wajahat mirza)
From: Christina
Date: Sunday, November 9, 2003 at 04:16:12
Comments: I am in 9th grade...taking Computer 1...and we are doing Visual i read all this stuff...i realize "hey i know how ta do that now" and its so awesome! my friend and i are creating a game and coding it, its pretty neat!
From: kevin
Date: Tuesday, July 22, 2003 at 05:04:02
Comments: haha screw $25 i'd pay someone $50 each to write my last 5 programs in VB.
From: Kimberly Smith
Date: Thursday, May 8, 2003 at 21:47:16
Comments: Hello!
My name is Kimberly.  The only thing stopping me from graduating is my visual basics class.  I have 6 more projects to complete.  Each project takes about 10 minutes (if you know what you're doing)!  I will pay someone $25.00 per project if they do it for me.  Please help!
From: Shabmaays
Date: Monday, April 21, 2003 at 10:09:56
Comments: Hello there your home page is excellent and am very impressed...but am having some problems with my vb classes...could you be of any help please dear....
From: Dennette G. Beasley
Date: Friday, March 7, 2003 at 04:27:40
Comments: I have a question, how do i include other information in the inputbox function (i.e. integers or multiple numbers.)
Reply: The InputBox function only returns strings.  If you want to get a number from it, you need to ask the user to put in a number and then use the Val function to get the number.  Also use the IsNumeric function to determine whether the user has entered a number or not.
From: imtiaz
Date: Sunday, November 17, 2002 at 15:33:32
Comments: i need some more details , this is good
From: Kim
Date: Tuesday, November 12, 2002 at 02:52:52
Comments: I'm also a new student and trying to print the form.

Could some please show me how to code a cmdprint to print the entire form.

Thanks, Kim


This can be done with the following code:

Private Sub cmdprint()
End Sub

Martin Allen 1999 - 2011.  Last updated Tuesday 09 August 2011 08:05:01 PM +0100.