|
||||||
| Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hello
I would like to be able determine how many times the user has been click one button. Does any one how I could able to count how many times the button has been click. Note: No Timer thank you |
| Sponsored Links |
|
|
|
|||
|
Even better, from an OOP perspective, would be to inherit the Button class, override OnClick, and keep track of it in there. You could expose a ReadOnly Property to show the count.
But, yeah, you could just store it in a global. |
|
|||
|
Quote:
Now, that being said, globals aren't really such a bad thing - they're just something to watch out for. Sometimes, the convenience of a global is worth it. But, then again, it's usually not too hard to replace a global with something (if only slightly) better. Back to the original question, I should've tried to flesh out why the number of clicks needed to be tracked. I suspect that road would lead us to a class who's job would be to take some action based on clicks - and that job should probably be moved out of the Form (where it no doubt lives right now). By proposing a ReadOnly Property to expose that information, I think I probably proposed splitting out the logic that deals with the number of clicks - and that's not normally a good thing. Just moving the tracking information inside a subclassed Button isn't really the whole solution, but based on the info given - it was the best I had at the moment. |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows XP Tricks & Tips!!!!..new ones. | pranky | Tutorials | 9 | 08-23-2008 03:22 PM |
| Java:Tutorial - Tic-Tac-Toe | John | Java Tutorials | 25 | 02-27-2008 06:41 PM |
| Disable a button | reachpradeep | ASP, ASP.NET and Coldfusion | 1 | 03-03-2007 02:35 PM |
| Number Cloning | Ronin | Java Help | 3 | 12-21-2006 07:23 AM |
| Button Click | Lop | C# Programming | 5 | 05-23-2006 09:06 AM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| LogicKills | ........ | 20.00000 |
| gaylo565 | ........ | 18.00000 |
| WingedPanther | ........ | 15.00000 |
| |pH| | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 67%