pyungel

pyungel

  • NA
  • 3
  • 0

Datagrid as a lookup table

Jan 6 2005 7:54 AM
What I am trying to do is so simple I can't believe I am struggling with it but there doesn't seem to be a simple solution. It is a simple lookup table. I have a windows form with a datagrid on it that is bound to a dataset. There are three columns in the datagrid: UserID, FullName, PhoneNo. When the user selects a row from the datagrid, I need to programmatically determine what the UserID is of the row selected so I can fully populate the information somewhere else. I have the entire row being highlighted with:
DataGrid.HitTestInfo hitInfo = DataGrid.HitTest(e.X, e.Y); //highlight the entire row if(hitInfo.Type == DataGrid.HitTestType.Cell) { dgDataGrid.CurrentCell = new DataGridCell(hitInfo.Row, hitInfo.Column);
dgDataGrid.Select(hitInfo.Row); } I can determine the row by using dgDataGrid.CurrentRowIndex but for the life of me, I can't determine what the UserID is in that row.

Answers (2)