473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Getting variable value from Input Box

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

Jul 17 '05 #1
1 21634
Something like

sngRaiseRate = InputBox("Enter a value")

Neil.
"J Buchman" <ja*********@comcast.net> wrote in message news:Oh********************@comcast.com...
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
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Varun | last post by:
I want to access the variable in the codebehind in the javascript How can i do that Varun
1
by: Varadha | last post by:
Hi, I am declaring a variable static char Version_No = '1' in header file header.h In a application "app.exe", i am changing the value of the variable in to '2' In the same application i am...
3
by: Helpseeker | last post by:
Hi all, I have written a small code in which i declare a static int variable and increment its value by one each time i click on a button. actually i use the int variable value in a particular URL...
5
by: Shapper | last post by:
Hello, I have this: Public Class index Inherits System.Web.UI.Page Public readMore As String ...
0
by: tharika_c | last post by:
Hi, We have a simple ASP.NET web application where one of the Session variables, called Session("SSO_ID") gets created and assigned a value (equal to the HTTP_HRID request variable value),...
1
by: rag84dec | last post by:
hi, I have the following code to get the button's value..It is giving empty string.... Can anyone help in getting the value of type button <form name='rag' action='tt.asp' method='post'>...
1
by: Tony Bansten | last post by:
Sorry for this newbie question, but how do I display a variable value from a *.vbs script in a dialog box and - secondly - how to read a user input from a dialog entry field into a *.vbs script...
1
by: Andyza | last post by:
I have a form with a number of textboxes. Each textbox has the same name. <input type="text" name="txtTest" value="1" onclick="GetValue()"> <input type="text" name="txtTest" value="2"...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.