I am working on a project using Visual Studio(c#). I want to create a startup form when i install my application with a progress bar. And after progress bar completed this form should be hide and a new form should be open. can u help me about this problem?
Share
Edit:
I’ve just made a sample application trying to use exactly the code that you’ve specified. It worked fine besides just one tweak:
Form1().Show();should benew Form1().Show();The only way this code does not execute is if you forgot to set
timer1toenabledstate in design view which causes the code to never fire up.Are you sure the code is firing up? have you done a break-point on this piece of code?
On a sidenote: timer1 is not on a separate thread so you don’t need to use Invoke (you can see if you actually need it by looking
InvokeRequiredproperty of a control)Suggested improvement: if you are not going to use Form2 again and judging from your code, it is likely you won’t; perhaps you should call
Close()on Form2 instead ofHide()and release the resources. I’ve had times when my application kept running in background because I hid the form but never closed it and application was on “exit when last window closes” which never happened.So to be sure, here is the final code that does work on my machine: