Parmas from form to form

  • Thread starter Thread starter chook.harel
  • Start date Start date
C

chook.harel

Maybe its not suppose to be in this group,
but i'm programming CF, so maybe it is :)
I'm trying to find out a good way of transfering data from one form to
the next one
and how is the change in forms occurs...

I tried
frmSales frmSales = new frmSales();
frmSales.Activate();
frmSales.Show();
in the form that starts (in the program.cs class)
frmWelcomeScreen frmWelcome = new frmWelcomeScreen();
Application.Run(frmWelcome);

and I have 2 questions.

1. how can I use the frmwelcome contianers from the frmsales..
2. how do I close a form when i move to the next one,
so that when the user clicks the X button.. It won't return to the old
one,
and will exit the program.
 
Many solutions depending on specific requirements.

Easiest in your case, keep a reference to frmwelcome at the class/form
level. If you have a reference you can call methods on it (e.g. Close) and
you can hook up to events from it (e.g. Closing).

Cheers
Daniel
 
Your forms are not static though right? That is what you were asking
originally.

If you are saying how to reference the main form (the one you pass to
Application.Run) from the static method Main, then I don't follow: Why do
you want to do that? When your main form closes, so will your app (assuming
no other threads are running).

Cheers
Daniel
 
Back
Top