If you design your application properly things like datasets won't be controlled by forms so you shouldn't need to pass a dataset between forms. Here is a good place to start: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/DesMVC.asp[^] Also, analysing the way you asked your question ("from another Form in the same project") I have some doubts about your understanding of Object Orientation. So you may like to read also http://www.codeproject.com/useritems/beginneroop.asp[^] which was written with examples in C++ but the concept equally applies to C# Finally, to actually answer your question I have provided a example implementation. In the method in the main form that opens the dialog do something like this:
DialogForm dlg = new DialogForm();
dlg.TheDataset = this.myDataset;
dlg.ShowDialog();
where: this.myDataset is your dataset and dlg.TheDataset is defined in your Dialog Form's class as
public Dataset TheDataSet
{
set
{
this.theDataset = value;
}
}
and that the Dialog Form also has a field defined as: private Dataset theDataset Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871)