Try This Out
dataGrid4.CurrentCellChanged += new EventHandler(Grid_CurCellChange);
private void Grid_CurCellChange(object sender, EventArgs e)
{
object currentCell = dataGrid4[dataGrid4.CurrentCell.RowNumber,
dataGrid4.CurrentCell.ColumnNumber]
}
Regards,
Dhanushka
"ClayB [Syncfusion]" <cl***@syncfusion.com> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
To get the value directly from the cell, try code like:
int colNr = dataGrid4.CurrentCell.ColumnNumber;
int rowNr = dataGrid4.CurrentCell.RowNumber;
object cellValue = dataGrid4[rowNr, colNr];
=================
Clay Burch, .NET MVP
Visit www.syncfusion.com for the coolest tools
"tigerbalm via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote
in message news:79******************************@DotNetMonste r.com... Hallo!
I have filled a datagrid with data from a database. I would like to edit
the data in the datagrid and save it back to the database. My problem is
that I don't really know how to capture the event of the cell that I am
editing. The code below works but I would like to edit the data in a
cell and then for example click a button and save it.
Here is little of my code :
void Button5Click(object sender, System.EventArgs e)
{
int colNr = dataGrid4.CurrentCell.ColumnNumber;
int rowNr = dataGrid4.CurrentCell.RowNumber;
string s = dataGrid4.CurrentCell.ToString();
string currentCellData = null;
EventHandler eh = null;
currentCellData = textBox2.Text;
DataGridCell dc = new DataGridCell(rowNr, colNr);
dataGrid4[dc] = currentCellData;
}