Results 1 to 3 of 3

Thread: [Resolved] Wait for the user to click a control?

  1. #1

    Thread Starter
    Junior Member kylek's Avatar
    Join Date
    Oct 2003
    Posts
    21

    [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.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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:
    1. 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
    2.         MsgBox(DirectCast(sender, Control).Name)'show name
    3.     End Sub

  3. #3

    Thread Starter
    Junior Member kylek's Avatar
    Join Date
    Oct 2003
    Posts
    21
    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
  •  



Click Here to Expand Forum to Full Width