Thanks for the reply.
I got what I wanted to achieve. What I did was create a new form inside a function. The form contains a continuously looping progressbar. Now i called this function inside a new thread.
I start the thread before calling the show() of main form. Once the main form is displayed, I abort() that thread.
Now I have a problem that after I call the abort(), the main form gets minimized. I mean it stays on the taskbar and not on the screen.
Why does it happen ?
You're going about this the wrong way. Add a form to your project and add a ProgressBar to that form. Set the ProgressBar's Style property to Marquee. There's your infinite progress bar. Now go to the Application tab of the project properties and select that form as the Splash Screen for the app. Now all you have to do is close the splash screen when the main form is displayed. If you want the splash screen to disappear just before the main form appears then do it last thing in the Load event handler. If you want the main form to appear before the splash screen disappears then do it first thing in the Shown event handler. Either way use this code:
Actually, I'm getting myself confused there. You don't need to explicitly close the splash screen anyway. It will be displayed for a minimum length of time, 2 seconds being the default. If the main form is ready to display before that it will wait at least that long. If the main form takes longer than that to construct and load then the splash screen will remain visible until its ready to display and then it will close on its own.
But you got to tell me what is wrong in the way I am doing ?
1> suppose I abort() a thread, then the thread called a function where a form was created. once I abort() the thread, the form.dispose() should be called automatically. Is it true ?
2> tell me to solve this problem. If a form is minimized, then using the code, can I bring the form to focus ( I mean it is brought to screen for the user)