troubleshooting Question

Question about good programming pracitce with data in Windows Forms.

Avatar of jammerms
jammerms asked on
Programming
9 Comments2 Solutions326 ViewsLast Modified:
Folks,

I am writing a Windows Forms application in C# using VS.NET 2003 for Pocket PC 2002, and I am new to it.  The current plan is to have an initial 'Welcome' screen where the user enters a userID and clicks a button to submit and continue.  The next page is a sort of 'Main Menu' from which three different logical paths (Scan, View, and Upload) branch out.  The user can be expected to go backwards within these paths to return to the Main Menu (but not the Welcome screen), and at some point, I will be loading a database into the program from the device.  My question is about good programming practice regarding when to instantiate the objects for the various forms and how to transmit the data between them.

Here's what the button click event looks like from the Welcome page:

            private void WelcomeButton_Click_1(object sender, System.EventArgs e)
            {
                  MainMenuForm mainMenu = new MainMenuForm(WelcomeTextBox.Text);
                  mainMenu.Show();
                  this.Hide();
            }
                --where WelcomeTextBox is where the user enters his or her userID and the MainMenuForm constructor argument is used to set the MainMenuForm private variable userID.

The best idea I have right now is to have MainMenu instantiate the objects for the Scan, View, and Upload pages as private variables and have those objects instantiate the further pages along their logical paths.  Is this the ideal way of designing the program?  Furthermore, when should I load the database and how does it transmit data to the different forms as the user moves along the program?

Any advice, pointers, links, etc. will be appreciated.

Thanks,
J
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros