| | |
A new question about adding and subtracting
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
First of all let me say I love this forum, everyone has been very nice and extremely helpful! Now to my question.
I got help with a question like this before and the answer I got worked perfectly. However I have a new angle. I'm wanting to take and subtract from a caption but after a random number has been chosen. Thus lets say at the click of a button a random number of 6 is picked. I want that to be subtracted from a caption that is set at 100. Thanks in advance for all the help!
I got help with a question like this before and the answer I got worked perfectly. However I have a new angle. I'm wanting to take and subtract from a caption but after a random number has been chosen. Thus lets say at the click of a button a random number of 6 is picked. I want that to be subtracted from a caption that is set at 100. Thanks in advance for all the help!
•
•
Join Date: Jul 2007
Posts: 192
Reputation:
Solved Threads: 16
Not sure understood your question, do you want to for ex subtract the number entered in label2 from label1 ? If so do the following
If IsNumeric(Me.Label1.Caption) Then
if IsNumeric(Me.Label2.Caption) then
Me.Label1.Caption = Me.Label1.Caption - Me.Label2.Caption
end if
end if
Or do you want to prompt the user for a number? Then use Inputbox
If IsNumeric(Me.Label1.Caption) Then
if IsNumeric(Me.Label2.Caption) then
Me.Label1.Caption = Me.Label1.Caption - Me.Label2.Caption
end if
end if
Or do you want to prompt the user for a number? Then use Inputbox
Hi,
use this:
I assume u know how to generate Random Number and is stored in RndVar. If u dont know, i will give u the code...
Regards
Veena
use this:
I assume u know how to generate Random Number and is stored in RndVar. If u dont know, i will give u the code...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim TLng As Long TLng = Val(Label1.Caption) - RndVar Msgbox "Result Is " & TLng
Regards
Veena
![]() |
Similar Threads
- Pointers (archived tutorial) (C++)
- Best way to develop db for survey? (Database Design)
- Monitor not doing true color anymore (Windows 95 / 98 / Me)
- Program Output Display Tweak Help (Java)
- Classes (C++)
- Using binary operators! (C)
- Pointers (C++)
- New Motherboard & Pre-installed Windows XP (Windows NT / 2000 / XP)
- a program about fractions (C++)
- Open proxy? (Windows NT / 2000 / XP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: problem with opening form
- Next Thread: help me i cant found any fault
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





