Solved

Displaying a form when Main Form of the application is loaded

Posted on 2004-09-15
3
238 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
ID: 12070453
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
ID: 12070760
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

735 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