我有Gridview,其中有6行。现在,当我单击对应行中的任何单元格时,我想获得聚焦行列值。例如,我想获得Student Exam_no,如果我点击学生姓名,地址或部门,我希望获得Exam_no的同一行中的任何单元格。如何完成我的任务?
private void gridControl2_Click(object sender, EventArgs e)
{
var frm = new New_Invoice();
frm.Show();
gridView1.RefreshData();
}
这个代码我试过但不能正常工作吗? 在此先感谢。
答案 0 :(得分:0)
Private Sub GridView1_RowCellClick(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs) Handles GridView1.RowCellClick
Dim myColumn As String = e.Column.FieldName ' for the datasource column name
Dim myValue = GridView1.GetFocusedDataRow(myColumn)
'For a standard one column
myValue = view.GetFocusedDataRow("ColumnX")
End Sub