473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to entertain the user during a slow.. InitializeComponent()

My program has 4 tabs with a few usercontrols that each have a lot of
controls on them. Added to that a few oleDb database connections etc.
Because of this the program spends a lot of time during
InitializeComponent() (>30sec on a P3-900MHz) I would like to display a
"splash" screen that displays the progress of InitializeComponent(). I'd
rather not edit the source of the InitializeComponent method, because Visual
Studio .NET plays around in it.

Right now I use a progressBar that slowly fills using a timer event on the
splash Form, but there is no real relation with the progress of
InitialializeComponent on the main Form.

I would really like to get some tips on alternative solutions to this
problem.

Thanks in advance for your time!
Nov 15 '05 #1
1 6115
Hi,

You can use a splash screen, here is some code that I'm using, you could
also make a google search

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

//You create the form in the Main function():
[STAThread]

static void Main()

{

splashform = new splash();

Application.Run(new Form1());

}
//You close it after the InitializeComponent () :
splashform.CloseIt();

//This is the splash form, I'm using an image on a borderless form
public class splash : System.Windows.Forms.Form

{

private System.Windows.Forms.PictureBox pictureBox1;

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;

DateTime time;

public splash()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

//

// TODO: Add any constructor code after InitializeComponent call

//

Show();

time = DateTime.Now;

Application.DoEvents();

}

public void CloseIt()

{

TimeSpan T = DateTime.Now - time;

if (T.Milliseconds<3000)

System.Threading.Thread.Sleep(3000-T.Milliseconds);

this.Close();

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if(components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(splash));

this.pictureBox1 = new System.Windows.Forms.PictureBox();

this.SuspendLayout();

//

// pictureBox1

//

this.pictureBox1.Image =
((System.Drawing.Image)(resources.GetObject("pictu reBox1.Image")));

this.pictureBox1.Location = new System.Drawing.Point(0, 0);

this.pictureBox1.Name = "pictureBox1";

this.pictureBox1.Size = new System.Drawing.Size(376, 208);

this.pictureBox1.TabIndex = 0;

this.pictureBox1.TabStop = false;

//

// splash

//

this.AutoScale = false;

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.BackColor = System.Drawing.Color.White;

this.ClientSize = new System.Drawing.Size(376, 205);

this.ControlBox = false;

this.Controls.Add(this.pictureBox1);

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;

this.MaximizeBox = false;

this.MinimizeBox = false;

this.Name = "splash";

this.ShowInTaskbar = false;

this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScree n;

this.TopMost = true;

this.ResumeLayout(false);

}

#endregion

}
"Fulcrum" <fu*********************@worldonline.nl> wrote in message
news:3f***********************@news.euronet.nl...
My program has 4 tabs with a few usercontrols that each have a lot of
controls on them. Added to that a few oleDb database connections etc.
Because of this the program spends a lot of time during
InitializeComponent() (>30sec on a P3-900MHz) I would like to display a
"splash" screen that displays the progress of InitializeComponent(). I'd
rather not edit the source of the InitializeComponent method, because Visual Studio .NET plays around in it.

Right now I use a progressBar that slowly fills using a timer event on the
splash Form, but there is no real relation with the progress of
InitialializeComponent on the main Form.

I would really like to get some tips on alternative solutions to this
problem.

Thanks in advance for your time!

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the...
3
by: Z D | last post by:
Hello, I've created a winform user control that, at some point in the default constructor, looks for a specifc file. When I try to load the user control to my winform's form during design time...
1
by: Kris van der Mast | last post by:
Hi, been a while since I posted a question myself instead of trying to help others out. I'm refactoring an existing web app that uses dynamic loading of user controls and a lot of...
2
by: okaminer | last post by:
Hi My problem is this I have a datetimepicker "Web server control", which I put on a "web user control". When I put the "web user control" on a web form, and try to open this web form, the...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
8
by: pamelafluente | last post by:
I am reposting hoping better luck :) I can't achieve this simple thing: I have an animated gif in an image control (ImageProgress1). The image visibility is set to false. I want that when the...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
0
by: mk397 | last post by:
Hello, I'm new to this site and after reading through many posts decided to join. I have a problem with my basic login page. After I type in the login info I get the following error: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.