john

john

  • NA
  • 1
  • 0

DataGrid row selection error

Feb 9 2006 10:57 AM
i have a datagrid which when i double click on the row it retrieves value from the specific row and fills data into a textbox

however when the datagrid is doubleclick the frist time the winform is loaded the row return is always the first row of my datagrid then the second  time i double click and anytime after that will give me the right row return i'm not sure how to fix this pls help? here's my code

DataTable DT = new DataTable();
DataView DV = new DataView();
DT=DS.Table[0]  
//DS is a dataset which is populate with data from my db already

DV=DT.DefaultView;
MyDataGrid.DataSource=DV;
int rowkey= DV[myDataGrid.CurrentRowIndex["columnname"];