我正在开发智能手机应用程序,我在winform中有一个DataGrid。
我想获取所选行的单元格的值..
答案 0 :(得分:7)
这将返回智能手机应用程序中DataGrid的选定单元格的值
MessageBox.Show(dgDataGrid[dgDataGrid.CurrentCell.RowNumber,
dgDataGrid.CurrentCell.ColumnNumber].ToString());
通过此,您可以获取或设置单元格值。
答案 1 :(得分:4)
如果我们的方法来自旧的VB.net紧凑框架项目,那么这里缺少信息是一个黑客。
For i As Integer = 1 To DataGrid.VisibleRowCount - 1
If DataGrid.IsSelected(i) Then
MessageBox.Show(DataGrid.Item(i, 0).ToString())
End If
Next
这将显示一个消息框,其中包含每个所选行的第一个单元格的内容。