>I have a simple form which contains a grid. The grid is populated by a data set. I would like to be able to click on a cell and then click a button that runs a method which needs the value in the cell.
>
>In VFP I could get the value by using the command thisform.grid1.column1.text1.value.
>
>What is the comperable command in .NET using C#? I can't seem to find the right syntax.
>
>thanks
>
>Alan Wyne
There are multiple ways and this is one of them:
int iRow = myDataGrid.CurrentCell.RowNumber;
int iCol = myDataGrid.CurrentCell.ColumnNumber;
DataSet ds = (DataSet)myDataGrid.DataSource;
MessageBox.Show( ds.Tables["tablename"].Rows[iRow][iCol].ToString() );
Cetin