Home All Groups Group Topic Archive Search About

click handler for Button in TableLayoutPanel

Author
15 Jun 2006 4:11 PM
swartzbill2000
Hello,
I have an array of Buttons down a column of a TableLayoutPanel. They
all share a common click handler. In the handler, how can I determine
the row of the TableLayoutPanel for the Button that got clicked?
Bill

Author
15 Jun 2006 5:05 PM
Chris Dunaway
swartzbill2***@yahoo.com wrote:
> Hello,
> I have an array of Buttons down a column of a TableLayoutPanel. They
> all share a common click handler. In the handler, how can I determine
> the row of the TableLayoutPanel for the Button that got clicked?
> Bill

Check out the GetPositionFromControl method of the TableLayoutPanel.
Author
15 Jun 2006 7:35 PM
swartzbill2000
It works. Thanks.

Chris Dunaway wrote:
Show quoteHide quote
> swartzbill2***@yahoo.com wrote:
> > Hello,
> > I have an array of Buttons down a column of a TableLayoutPanel. They
> > all share a common click handler. In the handler, how can I determine
> > the row of the TableLayoutPanel for the Button that got clicked?
> > Bill
>
> Check out the GetPositionFromControl method of the TableLayoutPanel.
Author
15 Jun 2006 7:49 PM
gene kelley
On 15 Jun 2006 09:11:41 -0700, swartzbill2***@yahoo.com wrote:

>Hello,
>I have an array of Buttons down a column of a TableLayoutPanel. They
>all share a common click handler. In the handler, how can I determine
>the row of the TableLayoutPanel for the Button that got clicked?
>Bill


In the handler, determine the Sender which exposes the control's Name,
Text and Tag properties (among others).

Dim WhichBtn As Button = DirectCast(sender, Button)
        WhichBtn.Name
        WhichBtn.Text
        WhichBtn.Tag


Gene