Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Automatic grid refresh

Hi guys,

Ok, Let me draw the picture before I ask the question...

I have 2 forms.

Form1 has a grid which is bound to a dataset and shows a couple of rows during run-time.
(It has the OleDbConnection, OleDbDataAdapter and DataSet icons at the bottom of the VB.net designer)

Form2 has all the controls to view all the informtion of a single row of the dataset.
(It ALSO has IT'S OWN OleDbConnection, OleDbDataAdapter and DataSet icons at the bottom of the VB.net designer)

What I need to do:

When I double-click on one of the rows in the grid of Form1, the row_id is passed on to Form2 and Form2 pops up with all the field info of that row inserted into dropdown and textboxes... So far so good. Now I can change the field info and hit a Save button on Form2 to update the dataset and CLOSE Form2... which also works fine... BUT NOW This is where the problem steps in... (1) How do I AUTOMATICALLY update my grid on Form1 to refelect the changes I have made and (2) where do I put this command? Or (3) What the hell am I missing ? ;)

A dumb working example would be MS Oulook... All your Contacts appear in a grid... Double click on a contact and a new form pops up... change it, save it, and the grid is updated instantaneously...

Another question:
Should I be working with 2 seperate Connections, Dataadapters and datasets... 1 set on each form? Is this part of the problem?

These are probably stupid questions... but any help will be much appreciated.


Comments

  • ridcodoitridcodoit Member Posts: 10
    If you are calling the second form as a dialog (form2.showdialog) then you could just clear the dataset and refill it.


    DataSet1.clear
    OleDBAdapter.fill(dataset1)

    that would refresh all bound controls.
    You'll want to keep your rownumber to go to that record though.

Sign In or Register to comment.