Question Using TableLayoutPanel

locks

New member
Joined
Nov 29, 2011
Messages
2
Programming Experience
Beginner
Hi,

I'm looking for help with using the TableLayoutPanel, I want to use it to display some data from a 2d array, and be able to get the row change color when the mouse is over a row.

I cant figure out how to accomplish this task, is this even possible to do with TableLayoutPanel?? I would also like to add a contextual menu when you right click on a row.

Here is the part of my code I use to populate the table:
VB.NET:
        For x = 0 To 31


            Dim FillCell As New Label
            FillCell.Name = array(x,0)
            FillCell.Text = array(x,0)
            TableLayoutPanel1.Controls.Add(FillCell, 0, x)


            Dim FillCell2 As New Label
            FillCell2.Name = array(x,1)
            FillCell2.Text = array(x,1)
            TableLayoutPanel1.Controls.Add(FillCell2, 1, x)


            Dim FillCell3 As New Label
            FillCell3.Name = array(x,2)
            FillCell3.Text = array(x,2)
            TableLayoutPanel1.Controls.Add(FillCell3, 2, x)


            Dim FillCell4 As New Label
            FillCell4.Name = array(x,3)
            FillCell4.Text = array(x,3)
            TableLayoutPanel1.Controls.Add(FillCell4, 3, x)


        Next

I cant find out how to detect where the mouse is in the table, and cant find out how I can highlight a row (change background color).
Any help is welcome,
Thanks
 
Yes I was considering Datagridview as well, does datagridview offer row mousehover or row click events? can I also add controls to dataviewgrid cells?

Thanks for the help
 
Back
Top