passing datasets between forms
Posted on 2007-03-23
I have a dataset that is bound to a grid. When you double click on a row in the grid, an edit screen pops up where you can add or edit records. I pass the dataset by reference. If I instead pop up the same screen with an add button, I add a row to the dataset, make my changes, then save. The problem is that if I add a row, even when I get to the add/edit screen, the grid on the main form will show a blank line. It is still bound to the dataset that was passed in (by val, which didn't really work).
The problem is that my "helper" form can add/edit the dataset, but it is affecting the main "browse" form. I don't think that it is a good idea to have forms effect other forms data. How are you supposed to do this? Should I make a copy of the dataset, change that, then merge when I get back to the main page? create a new row, only add to the ds when I save? If I do, what happens when they violate some dataset constraints?
What are my options, and what is the best way to do this? I don't want to have go to the database every time I pop up a screen. I would rather edit the ds that I have, but I dont' want it to effect grids.