【发布时间】:2013-01-15 13:40:59
【问题描述】:
我试图从数据网格中选定行的单元格中获取值,但徒劳无功。我已经能够在 Windows 窗体中的 datagridview 中轻松地做到这一点,但在 wpf datagrid 中同样不起作用。到目前为止我尝试过的代码如下:
`If Me.mileGrd.Items.Count > 0 Then
If Me.mileGrd.SelectedItems.Count > 0 Then
MessageBox.Show("check me")
Dim cnum As String = Me.mileGrd.SelectedItems(0).Cells("Car No").Value
'do more stuff here
End If
End If`
mileGrd 是数据网格。
当我运行程序时,我收到一条错误消息 Public member 'Cells' on type 'DataRowView' not found 。在这种情况下,我可以用什么来读取数据网格中选定行的单元格值,并将列标题作为参数,如Car No?任何帮助表示赞赏。
【问题讨论】:
标签: vb.net wpfdatagrid