A new question about adding and subtracting

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2007
Posts: 15
Reputation: venomocity is an unknown quantity at this point 
Solved Threads: 0
venomocity's Avatar
venomocity venomocity is offline Offline
Newbie Poster

A new question about adding and subtracting

 
0
  #1
Aug 19th, 2007
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!
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 192
Reputation: plusplus is an unknown quantity at this point 
Solved Threads: 16
plusplus plusplus is offline Offline
Junior Poster

Re: A new question about adding and subtracting

 
0
  #2
Aug 19th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: A new question about adding and subtracting

 
0
  #3
Aug 19th, 2007
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...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim TLng As Long
  2. TLng = Val(Label1.Caption) - RndVar
  3. Msgbox "Result Is " & TLng

Regards
Veena
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC