943,623 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 22560
  • VB.NET RSS
Aug 9th, 2008
0

How to check if a button was clicked ?

Expand Post »
How do you check if a button was clicked in Visual Basic .NET ?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
R3B3L is offline Offline
20 posts
since Mar 2008
Aug 9th, 2008
0

Re: How to check if a button was clicked ?

Last edited by PsychicTide; Aug 9th, 2008 at 9:36 am.
Reputation Points: 54
Solved Threads: 15
Junior Poster
PsychicTide is offline Offline
113 posts
since Aug 2008
Aug 9th, 2008
0

Re: How to check if a button was clicked ?

tx but Niether thread answered my question.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
R3B3L is offline Offline
20 posts
since Mar 2008
Aug 9th, 2008
0

Re: How to check if a button was clicked ?

Hi,
> Use a boolean variable (bBtnClicked)
> Initially Keep it false (bBtnClicked = false)
> Whenever user click the button Make it True (bBtnClicked = True in Click Event)
> Now the boolean variable having the result whether button is clicked or not .
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Aug 9th, 2008
0

Re: How to check if a button was clicked ?

Dim cmdClicked As Boolean = False
If (cmdClicked = True in cmdOne event) Then
End If

???
Reputation Points: 10
Solved Threads: 0
Newbie Poster
R3B3L is offline Offline
20 posts
since Mar 2008
Aug 9th, 2008
0

Re: How to check if a button was clicked ?

Please anyone help,

I have a button named "cmdOne" and i want to know if it was clicked.

I created a boolean:

Dim clicked As Boolean = False
If (clicked == True) .... ????

How do I finish this ? Please Advice, I can't go on with my program without knowing how to do this and I have been stuck trying to do it over 7 hours...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
R3B3L is offline Offline
20 posts
since Mar 2008
Aug 9th, 2008
1

Re: How to check if a button was clicked ?

Somewhat correct. But you have to declare the variable at Form level not inside Click Event Handler

VB.NET Syntax (Toggle Plain Text)
  1. Dim bBtnClicked As Boolean = False
  2. Private Sub cmdOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOne.Click
  3. If bBtnClicked = True Then
  4. MessageBox.Show("This button is clicked already ....")
  5. Else
  6. MessageBox.Show("This button is clicked First time ....")
  7. End If
  8. bBtnClicked = True
  9. End Sub
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008

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 VB.NET Forum Timeline: Time Input
Next Thread in VB.NET Forum Timeline: using multiple forms





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


Follow us on Twitter


© 2011 DaniWeb® LLC