Re: Get name of control at a certain mousedown point
From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 02/11/05
- Next message: Cor Ligthert: "Re: return sharename using System.IO?"
- Previous message: Cor Ligthert: "Re: dateTime in Web Services"
- In reply to: Brad: "Get name of control at a certain mousedown point"
- Next in thread: Brad: "Re: Get name of control at a certain mousedown point"
- Reply: Brad: "Re: Get name of control at a certain mousedown point"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Feb 2005 15:00:41 +0100
The mouse event's will be handled by the individual controls so you'll need
to wire all the controls click events up to a handler in the tab page or tab
control.
-- Bob Powell [MVP] Visual C#, System.Drawing Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "Brad" <ballison@ukcdogs.com> wrote in message news:%237iqPEEEFHA.3120@TK2MSFTNGP12.phx.gbl... >I have several labels and textboxes that are drawn to a tab page based on >certain criteria so these labels and textboxes can be drawn at different >points on the tab page. I set the label and textbox names in the drawing >procedure. Now what I need to do is to get the control's information on a >mouse down. > > Here is what I have: > > //// > Private Sub tcGuard_MouseDown(ByVal sender as Object, ByVal e as > System.Windows.Forms.MouseEventArgs) Handles tcGuard.Mousedown 'tcGuard > is a tab control > Dim mouseLocale as new point(e.X, e.Y) > dim tName as String > dim cntrl as New Control > cntrl = tcGuard.GetChildAtPoint(mouseLocale) > tname = cntrl.Name > End Sub > \\\\ > > Here is the error message I get: Object reference not set to an instance > of an object. > > All I need to do at this juncture is get the name of the label or textbox > that the mouse clicked on. > > If I am doing this wrong, please let me know and thanks for any help you > can give. > > Brad >
- Next message: Cor Ligthert: "Re: return sharename using System.IO?"
- Previous message: Cor Ligthert: "Re: dateTime in Web Services"
- In reply to: Brad: "Get name of control at a certain mousedown point"
- Next in thread: Brad: "Re: Get name of control at a certain mousedown point"
- Reply: Brad: "Re: Get name of control at a certain mousedown point"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|