|
-
Oct 26th, 2006, 06:35 PM
#1
Thread Starter
New Member
reseting
I have a value in th picbox and it is a counter adding one each click how do i make it if it add one each time>
VB Code:
Dim num As Integer
Private Sub cmdclick_Click()
picscore.Cls
NumberCount = 1
End Sub
Private Sub cmdclick_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
num = num + 1
picscore.Print num
End Sub
-
Oct 26th, 2006, 06:37 PM
#2
Re: reseting
VB Code:
Dim num As Integer
Private Sub cmdclick_Click()
picscore.Cls
[b]NumberCount = 1[/b]
End Sub
Private Sub cmdclick_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
num = num + 1
picscore.Print num
End Sub
remove the line in bold.
Plus, you have two subs that activate at the exact same time... Click and MouseDown events on a Command Box accomplish the same thing.
-
Oct 27th, 2006, 04:24 AM
#3
Re: reseting
you need to declare num as a static, then it remembers the last value when the sub is run again
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|