OK. I have 2 forms. The main form has an OLEDBConnection, 2 OLEDBDataAdapters, and 2 datasets.
There are 2 combo boxes on the form, both of which are bound to the same table of an Access file (hence the 2 of adapters and datasets), and are filled up with the primary key from that table on the form load.
There are textboxes for each combo box that change values when the combo box selection is changed. It will query against the selection in the combo box(primary key in the table) and put the values into the text boxes from the corresponding record.
So now I've made another form to enter in new records. And I would like those records to be displayed as soon as I go back the main form in the list in the combo box.
My ideal plan was to put this in a form close event of the add records form or something, but there is none. So I made a button on the add records form to "refresh" the data to be used on the main form.
I've tried saying that the datasets on the main form HaveChanges(), AcceptChanges(), datadapters.Fill(dataSets), mainForm.Refresh(), comboboxes.Refresh(). This is to no avail.
What would my best approach be to this?
If I was using VB 6, I would have made an ADO, and pre-bound all text boxes to the table, set the Recordsource for the ADO to a SQL statement to hit the first record in the db, then when the value in the combo box changed, change the record source in the ADO to a new SQL command, refresh it, and the new values would appear in the text box.
But how do I do it here?
Also, how do you unload a form in .Net? My ideal situation would be when I press the button on the main form to enter a new record, the main form goes away, and I press a button to re-load the main form on the add records form, and the add-records form goes away.
Thanks in advance.
There are 2 combo boxes on the form, both of which are bound to the same table of an Access file (hence the 2 of adapters and datasets), and are filled up with the primary key from that table on the form load.
There are textboxes for each combo box that change values when the combo box selection is changed. It will query against the selection in the combo box(primary key in the table) and put the values into the text boxes from the corresponding record.
So now I've made another form to enter in new records. And I would like those records to be displayed as soon as I go back the main form in the list in the combo box.
My ideal plan was to put this in a form close event of the add records form or something, but there is none. So I made a button on the add records form to "refresh" the data to be used on the main form.
I've tried saying that the datasets on the main form HaveChanges(), AcceptChanges(), datadapters.Fill(dataSets), mainForm.Refresh(), comboboxes.Refresh(). This is to no avail.
What would my best approach be to this?
If I was using VB 6, I would have made an ADO, and pre-bound all text boxes to the table, set the Recordsource for the ADO to a SQL statement to hit the first record in the db, then when the value in the combo box changed, change the record source in the ADO to a new SQL command, refresh it, and the new values would appear in the text box.
But how do I do it here?
Also, how do you unload a form in .Net? My ideal situation would be when I press the button on the main form to enter a new record, the main form goes away, and I press a button to re-load the main form on the add records form, and the add-records form goes away.
Thanks in advance.