T
tigerbalm via DotNetMonster.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;
}
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;
}