gonzal13
asked on
Visual Basic simple Question
I have a question that has frustrated me while doing my homework. We do not get grades on it. I am 58 and taking it as a 'recreational' subject with the intention to know as much as possible.
I have a txtBox where one enters a Number. I then have a Summary Box which supposed to take the contents of the box and plases it on command into a lbl box. The intention is to accumulate numbers in the Summary box. For some reason it does not work. I can accumulate numbers from a lblbox to a lbl Box but from a txt Box to a lable summary box results in a blank entry.
The 'Sales' commands work as shown below:
Dim curWeeklySales As Currency
Dim SummaryWeeklySales1 As Currency
curWeeklySales = Val(txtWeeklySales)
lblSummaryWeeklySales1.Cap tion = FormatNumber(curWeeklySale s) _
+ Val(lblSummaryWeeklySales1 .Caption)
The following where out of frustration gave the cammand a number, resulted in a blank.
Dim curSummaryWeeklyPay1 As Currency
lblSummaryWeeklyPay1.Capti on = 10000 This results in a blank
lblSummaryWeeklyPay1.Capti on = Val(LblPay1.Caption) This also results in a blank
gonzal13(Joe)
I have a txtBox where one enters a Number. I then have a Summary Box which supposed to take the contents of the box and plases it on command into a lbl box. The intention is to accumulate numbers in the Summary box. For some reason it does not work. I can accumulate numbers from a lblbox to a lbl Box but from a txt Box to a lable summary box results in a blank entry.
The 'Sales' commands work as shown below:
Dim curWeeklySales As Currency
Dim SummaryWeeklySales1 As Currency
curWeeklySales = Val(txtWeeklySales)
lblSummaryWeeklySales1.Cap
+ Val(lblSummaryWeeklySales1
The following where out of frustration gave the cammand a number, resulted in a blank.
Dim curSummaryWeeklyPay1 As Currency
lblSummaryWeeklyPay1.Capti
lblSummaryWeeklyPay1.Capti
gonzal13(Joe)
ASKER
Please note that the last line of code istxt instead of lbl
lblSummaryWeeklyPay1.Capti on = Val(LblPay1.Caption) This also results in a blank
The above is the complete code for this mnu command
In frustration to see what would happen I forced lblSummaryWeeklyPay1.capti on to = 10000
gonzal13(Joe)
Oh, since Microsoft introduced VB.net, the VB6 books can be had at 20 percent of their value on Amazon and half.com
lblSummaryWeeklyPay1.Capti
The above is the complete code for this mnu command
In frustration to see what would happen I forced lblSummaryWeeklyPay1.capti
gonzal13(Joe)
Oh, since Microsoft introduced VB.net, the VB6 books can be had at 20 percent of their value on Amazon and half.com
Try this:
lblSummaryWeeklyPay1.Capti on = Val(LblPay1.text) This also results in a blank
I know that doesnt make much sense because you have it defined as lblPay1.
But you said "Please note that the last line of code istxt instead of lbl"
I am assuming that you mean its a text box and not a label.
So to get text from a text box you can either do, Text1 or Text1.text.
Good Luck
-Brian
lblSummaryWeeklyPay1.Capti
I know that doesnt make much sense because you have it defined as lblPay1.
But you said "Please note that the last line of code istxt instead of lbl"
I am assuming that you mean its a text box and not a label.
So to get text from a text box you can either do, Text1 or Text1.text.
Good Luck
-Brian
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
lblSummaryWeeklyPay1.Capti on = Val(LblPay1.text)
ASKER
Hi:
I shall take your notes to the professor today (Tuesday)
my final version that does not work is
lblSummaryWeeklyPay1.Capti on = Val(txtPay1.text)
I shall take your notes to the professor today (Tuesday)
my final version that does not work is
lblSummaryWeeklyPay1.Capti
lblSummaryWeeklyPay1.Capti on = Val(txtPay1.text)
This should work, even if txtPay1.text is blank, the label would come out as zero.
Just a suggestion, have you made the Label forecolor the same as the backcolor? For example printing blue characters on a blue background. Or have you made the label too small or too big, and the characters are falling of the form?
May I suggest you put some text into the caption properties at design time, just to prove you can see it.
This should work, even if txtPay1.text is blank, the label would come out as zero.
Just a suggestion, have you made the Label forecolor the same as the backcolor? For example printing blue characters on a blue background. Or have you made the label too small or too big, and the characters are falling of the form?
May I suggest you put some text into the caption properties at design time, just to prove you can see it.
lblSummaryWeeklyPay1.Capti
lblSummaryWeeklyPay1.Capti
This works ok for me, are you sure the label names are correct?
Also where is LblPay1.Caption getting its value from? If its blank then lblSummaryWeeklyPay1 will be blank.
Can you post your whole code? i.e. Everything under the button click?