Refresh a dataset?
Date: 02/09/06
(C Sharp) Keywords: microsoft
I do hope this is an easier question (and that the answer isn't marred by an obscure Microsoft bug this time) than the last one.
I was going to try and do this generically, but it got too long-winded.
Form A: Categories. One of the columns in the datagridview is Parent (the Parent of the Category, naturally), and that column (a comboboxcolumn) has a datasource that points to the Parent table insteadof the Category table, and a Value Member of Parent. Form A also contains a button to open up form B.
Form B: has a datagridview that allows editing of the Parent table (to add new Parents).
At present, the code for the button on Form A is very simple:
BrowseParent frmParent = new BrowseParent();
frmParent.Show();
What I'd like to be able to do is monitor frmParent from inside this routine, and force the dataset pointing to the Parents table to refresh after frmParent closes (or, better, when btnSave is pressed in frmParent). Which leads me to two questions:
1. Is it possible to check from inside this routine to see if frmParent has closed? Or is it ultimately going to be easier friending the class(es) and doing it that way?
2. Is it, in fact, possible to force a refresh of a dataset without closing and reopening the form? Can't seem to find anything on it in BOL, and the dataset doesn't seem to have a Refresh() command attached to it.
Strike that, I really am as dumb as I look. I just called the tableadapter's fill() routine again.
Thanks.
Source: http://community.livejournal.com/csharp/49637.html