I think I have to obtain the index of the detail row that is selected by the user (I don't know how)
Once I have that, how do I get the content of a particular cell of the selected detail row?
Thanks.
Hi,
This line of code is unnecessarily complex and doesn't really make sense.
grid.Rows(grid.ActiveCell.Row.ParentRow.Index) can be simplified to 'grid.ActiveRow.ParentRow'
So then you are taking that row and getting it's child rows collection and getting the active row again from there. You're just going in circles. This entire line of code could be re-written as:
grid.ActiveRow.Cells("Detail").Value
Thank you Mike,
what finally worked for me was
grid.Rows(grid.ActiveCell.Row.ParentRow.Index).ChildBands(0).Rows(grid.ActiveCell.Row.Index).Cells("Detail").Value
Thanks again!
The grid.Selected.Rows collection contains a list of all selected rows. It doesn't matter if those rows are child rows or parent rows or what band the rows are in.
Hi Mike, but I need to retrieve the data from whichever child row might be active (or selected) How can I determine whether a child row is selected or has focus and how could I access the content of a certain cell of that child row?
The Index of a row is not a very reliable way to access a row, because the Index can change in any number of ways. Sorting, filtering, adding, or deleting rows can change the Index.
If you just want to retrieve data from a selected row, then you can do this like so:
if (grid.Selected.Rows.Count > 0)
grid.Selected.Rows[0].Cells[columnKey].Value