944,073 Members | Top Members by Rank

Ad:
Aug 19th, 2007
0

A new question about adding and subtracting

Expand Post »
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!
Similar Threads
Reputation Points: 2
Solved Threads: 0
Newbie Poster
venomocity is offline Offline
16 posts
since Aug 2007
Aug 19th, 2007
0

Re: A new question about adding and subtracting

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
Reputation Points: 10
Solved Threads: 16
Posting Whiz in Training
plusplus is offline Offline
207 posts
since Jul 2007
Aug 19th, 2007
0

Re: A new question about adding and subtracting

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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: problem with opening form
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: help me i cant found any fault





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC