I hope that someone will face the same predicament that I have encountered. I am developing a .NET 2.0 Winforms application and am trying to exchange an ADO.NET data object between two different winforms.
I have a button on form1 that, when clicked, instantiates another form object and shows it modally. The second modal form allows the user to fulfill some search criteria and return ado.net search data.
When the user closes the modal form, I want the Datatable of the search results to return back to the original form, but as I step over the code, I see the original empty datatable.
Thus, the second form has its own constructor, in which I try to pass to datatable that I am interested in the exchange between both forms.
I understand that when you pass an object as a parameter to a function or constructor, you are in the "link" mode, and you control the original contents of the object? But this is not what seems to be happening here. Any insight would be greatly appreciated.
early.
DataTable searchResults = new DataTable();
Search searchForm = new Search(this.DropdownDataset, searchResults);
searchForm.ShowDialog(this);
public Search(DataSet dropdownData, DataTable searchResults)
{
this.InitializeComponent();
this._dropdownData = dropdownData;
this._lidSearch = new LIDSearch();
this._searchResults = searchResults;
}
source
share