Computing.Net > Forums > Programming > Command counting in VB!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Command counting in VB!

Reply to Message Icon

Name: Berty
Date: December 3, 2002 at 06:52:04 Pacific
OS: Xp Pro
CPU/Ram: 1.1 Gig 256 DDR
Comment:

Hi guys,
An easy VB question for all you pros!!!
Can anyone tell me if the number of times a command button is 'clicked' can be counted.

If so could you please tell me how.

Thanks guys

Berty



Sponsored Link
Ads by Google

Response Number 1
Name: Burbble
Date: December 3, 2002 at 09:57:15 Pacific
Reply:

Declare a variable for the form, such as:

Dim ClickCount as Long

Then in the Command_Click event, put:

ClickCount = ClickCount + 1

-Burbble


0

Response Number 2
Name: Berty
Date: December 3, 2002 at 12:20:53 Pacific
Reply:

Thank you very much Burbble, I knew I could count on you guys here!!!



0

Response Number 3
Name: BaBa
Date: December 3, 2002 at 17:37:13 Pacific
Reply:

Put a command button on the form
in the Click event put this code

Private sub Command1_Click()

Static Counter as long
Counter=counter+1
Print Counter

End sub


The variable declaration must be static.


0

Response Number 4
Name: Burbble
Date: December 4, 2002 at 03:57:34 Pacific
Reply:

It doesn't have to be...

-Burbble


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Command counting in VB!

Command Button Behaviour-VB.Net www.computing.net/answers/programming/command-button-behaviourvbnet/11728.html

Update command in VB.NET www.computing.net/answers/programming/update-command-in-vbnet/3989.html

How to use Switch statement in vb www.computing.net/answers/programming/how-to-use-switch-statement-in-vb/6687.html