How to get selected row in DataGrid in smartphone application?
-
26-09-2019 - |
Question
I am working on a smartphone application, where I have a DataGrid in winform.
I want to get the value of cell of the selected row..
Solution
This will return the value of selected cell of DataGrid in smartphone application
MessageBox.Show(dgDataGrid[dgDataGrid.CurrentCell.RowNumber,
dgDataGrid.CurrentCell.ColumnNumber].ToString());
Through this you can get or set the cell value.
OTHER TIPS
Through lack of information here is a hack of one if our methods from an old VB.net compact framework project.
For i As Integer = 1 To DataGrid.VisibleRowCount - 1
If DataGrid.IsSelected(i) Then
MessageBox.Show(DataGrid.Item(i, 0).ToString())
End If
Next
This will show a message box with the contents of the first cell of each selected row.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow