G
Guest
Hi, I have a window based program. One of the form has several textboxes and
a datagrid. The textboxes are bind to the same dataset table as the datagrid
and the text changes to reflect different row selected in the datagrid.
I want to save the changes that user make in the textboxes when they select
a different row in the datagrid. I tried capturing the textbox.text at
datagrid's CurrentCellChanged event but by then the textbox.text is lost
already becuase the binding is to the new currently selected row.
private void VListing_CurrentCellChanged(object sender, System.EventArgs e)
{
if(Changed)
{
dsVehicle.Tables["vehDetail"].Rows[prevRow]["Model"] = test;
prevRow = VListing.CurrentCell.RowNumber;
UpdateDataSet(dsVehicle);
}
Changed = false;
}
private void txtVModel_Validated(object sender, System.EventArgs e)
{
test = txtVModel.Text.ToString();
}
I tried capturing the textbox.text at textbox validated event and then
assign that to the dataset.tables.rows[col] and then update the database but
that isn't working either. I did capter the textbox.text but the assignment
to the dataset and update to the database is not working. Can someone tell
me what's the best way to do this? Or point me to an example?
Thanks, Alpha
a datagrid. The textboxes are bind to the same dataset table as the datagrid
and the text changes to reflect different row selected in the datagrid.
I want to save the changes that user make in the textboxes when they select
a different row in the datagrid. I tried capturing the textbox.text at
datagrid's CurrentCellChanged event but by then the textbox.text is lost
already becuase the binding is to the new currently selected row.
private void VListing_CurrentCellChanged(object sender, System.EventArgs e)
{
if(Changed)
{
dsVehicle.Tables["vehDetail"].Rows[prevRow]["Model"] = test;
prevRow = VListing.CurrentCell.RowNumber;
UpdateDataSet(dsVehicle);
}
Changed = false;
}
private void txtVModel_Validated(object sender, System.EventArgs e)
{
test = txtVModel.Text.ToString();
}
I tried capturing the textbox.text at textbox validated event and then
assign that to the dataset.tables.rows[col] and then update the database but
that isn't working either. I did capter the textbox.text but the assignment
to the dataset and update to the database is not working. Can someone tell
me what's the best way to do this? Or point me to an example?
Thanks, Alpha