Solved

Displaying a form when Main Form of the application is loaded

Posted on 2004-09-15
3
235 Views
Last Modified: 2010-08-05
Hi,

I need to show a preference form when the application is first launched. If I show the preferences form at the Form_Load event of the application main form, the main form is not displayed. I want that the main form is launched then the preferences form is displayed. Any suggestions?

Thanks, Nauman.
0
Comment
Question by:nauman_ahmed
3 Comments
 
LVL 9

Accepted Solution

by:
s_sansanwal earned 250 total points
Comment Utility
Open form in PAINT event and add a flag

            private bool loaded = false;
            private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
            {
                  if(loaded == false)
                  {
                        Form2 frm = new Form2();
                        frm.ShowDialog();
                        loaded = true;
                  }
            }

Hope this helps.

S Sansanwal
0
 
LVL 3

Assisted Solution

by:GrumbleBot
GrumbleBot earned 250 total points
Comment Utility
In the constructor add this after InitializeComponent();

   this.Show(); //display the main form
   Form2 f = new Form2(); //Your preference form
   f.ShowDialog(); // then display your preference form

hope this helps
good luck

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now