Home Forums WinForms controls Xceed Grid for WinForms Right click and get row values Reply To: Right click and get row values

Xceed Support
Member
Post count: 5658

Hi Peter,

Because the row (CellRows) contain cells, it is the cells that will capture the events and not the cellrow. Therefore, you will need to subscribe to the events of each cell in the row if you want to know when the user clicks on a row. For example:

GridControl1.BeginInit()

GridControl1.DataSource = DataSet11
GridControl1.DataMember = “Orders”

Dim cell As DataCell

For Each cell In GridControl1.DataRowTemplate.Cells
AddHandler cell.Click, AddressOf Me.cell_Click
Next cell

GridControl1.EndInit()

In the Click event handler, you can then check the cell’s <a href=”http://doc.xceedsoft.com/products/gridNet/ref/xceed.grid.cell.parentrow.html”>ParentRow</a&gt; property to access the row. For example:

Dim cell As Cell = CType( sender, Cell )
Dim parentRow As CellRow = cell.ParentRow

I hope this helps!

Imported from legacy forums. Posted by Jenny [Xceed] (had 3119 views)