I have a datagrid which i am filling up on form load.
I have ADD, MODIFY, DELETE and REFRESH buttons on this form and the triggered functions do their job well.Code:private void Form1_Load(object sender, System.EventArgs e) { sqlDataAdapter1.Fill(dsCoops1); }
The problem comes when I try to make the datagrid reflect the changes (REFRESH button). If I add or modify, I can do a refill (like on form load) of the dataset and the changes automatically show up in the datagrid. BUT, when I delete a row from the datasource, the refill doesnt work since the Fill() only seems to update and add rows but not remove them from the dataset.
Ive tried various approaches to this and none work. Doing a Clear() on the dataset before refilling works except that for some reason when i try to get the CurrentRowIndex from the datagrid it always returns a '0'.
Other stuff Ive tried:Code:dsCoops1.Clear(); sqlDataAdapter1.Fill(dsCoops1);
Thanks to anyone who can help!Code:sqlDataAdapter1.Fill(dsCoops1); dataGrid1.Refresh() // tried Update() too
*eanatum*




Reply With Quote