Sorry if this was already posted... I need help with creating spalsh screens
and little progress windows that would be used during lenghty process,
indicating that the application has not locked up... Any ideas?
Thanks a lot!
Have a great day!
Sasha
You are right, it has been posted several times already
Anyway , this is the code I'm using
[STAThread]
static void Main()
{
splashform = new splash();
Application.Run(new Form1());
}
//Now in the constructor of Form1 you run your init code: and call the
CloseIt method of the splash window
public Form1()
{
try
{
DataProvider.LoadData();
splashform.CloseIt();
}
catch( Exception e)
{
MessageBox.Show( e.Message + " In Main ");
}
}
Splash is a winform class, defined as usual:
public splash()
{
InitializeComponent();
Show();
time = DateTime.Now;
Application.DoEvents(); //this is important as it allow the calling windows
to continue to loading
}
//Here I test if the windows has been visible for a required amount of time,
if not just sleep until I have.
public void CloseIt()
{
TimeSpan T = DateTime.Now - time;
if (T.Milliseconds<3000)
System.Threading.Thread.Sleep(3000-T.Milliseconds);
this.Close();
}
Hope this code help, if not take a look at
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=%22splash+screen%22&meta=group%3Dmicrosoft.public.dotnet.*
for a discussion of several ways of doing so
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Sasha" <ZseZc...@ua.fm> wrote in message
news:u6mfvivH...@TK2MSFTNGP11.phx.gbl...
"Sasha" <ZseZc...@ua.fm> wrote in message
news:u6mfvivH...@TK2MSFTNGP11.phx.gbl
>.
>