Global Variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am building a Windows application that has multiple forms. I am creating a
dataset in one form and would like to know how to pass the results of that
dataset to another form. Please provide some example code, thanks.
 
There could be multiple approach to exchange data among various forms.

Simple way is to pass the data through the constructor.
In your case, you could send the data set from one form to 2nd form via
constructor of 2nd form.

The second approach which is not advisasble is to store this dataset in some
public static variable thus could be accessed by the 2nd form.

Regards
Tariq Karim
 
Thanks Tariq,

I am relatively new to the C#.Net language, could you provide a snippet of
code as an example. Thanks
 
Back
Top