I am trying to do my VB 6 homework with an exercise that requires the use of variables, constants and string concatenation. I can't get the program to use the percentage that is put into the text area of the input box....what I am supposed to do is make this happen:
Use the input box to prompt the clerk to enter a raise in percentage at the beginning of the application. Also assign the "Raise percentage:" to a constant.
If I make the sngRaiseRate = a constant like sngRaiseRate = .05 it works...but the value is supposed to be coming from the input text prompt...I'm stumped...any help would be appreciated very much.
Jack
my current code looks like this:
Dim sngRaiseRate As Single
Private Sub cmdCalc_Click()
'declare the variables
Dim sngRaiseRate As Single, sngCurrent1 As Single, sngCurrent2 As Single, sngCurrent3 As Single, sngNew1 As Single, sngnew2 As Single, sngnew3 As Single
'assign values to the variables
sngCurrent1 = Val(txtCurrent1.Text)
sngCurrent2 = Val(txtCurrent2.Text)
sngCurrent3 = Val(txtCurrent3.Text)
sngRaiseRate = Val ????? How do I get it to use a percentage I type in the input box prompt?
'calculate the new hourly pay
lblNew1 = sngCurrent1 + (sngCurrent1 * sngRaiseRate)
lblNew2 = sngCurrent2 + (sngCurrent2 * sngRaiseRate)
lblNew3 = sngCurrent3 + (sngCurrent3 * sngRaiseRate)
'display the new hourly pay
lblNew1.Caption = Format(lblNew1, "currency")
lblNew2.Caption = Format(lblNew2, "currency")
lblNew3.Caption = Format(lblNew3, "currency")
cmdPrint.SetFocus
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdPrint_Click()
PrintForm
txtCurrent1.SetFocus
End Sub
Private Sub Form_Load()
Const conPrompt As String = "Raise the rate 5%"
Const conTitle As String = "Rate Raise"
txtRaiseRate = InputBox(conPrompt, conTitle)
End Sub