|
-
Oct 21st, 2003, 11:13 PM
#1
Thread Starter
Junior Member
[Resolved] Wait for the user to click a control?
I've been doing some digging around on the net but I cant seem to find anything helpfull on the subject.
I have a form with a bunch of controls and I want to write a function that will wait until the user clicks on one of the controls, and returns the control name.
Any ideas on how I can do this? Or links to some good resources?
Thanks,
Last edited by kylek; Oct 21st, 2003 at 11:51 PM.
-
Oct 21st, 2003, 11:42 PM
#2
Just put the code you want to run in the click event of the control in question. If you want the same thing to happen for every control on the form than add them all to the handles statement of the same click event handler. And use this to get the name: Msgbox(DirectCast(sender,Control).Name)
Something like this:
VB Code:
Private Sub All_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, TextBox1.Click, Label1.Click 'add all controls here like shown
MsgBox(DirectCast(sender, Control).Name)'show name
End Sub
-
Oct 21st, 2003, 11:47 PM
#3
Thread Starter
Junior Member
you know... I guess I was thinking too hard on this one.
What I was looking for was a way to have a single function that would just tell me the next control that was clicked since I dont care if the user clicks most of the time. But having the controls return that they have been clicked and just checking against a flag should work fine.
Thanks
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
|