howto show a form once

aniskhan

Well-known member
Joined
Oct 24, 2005
Messages
90
Location
D.I.Khan
Programming Experience
1-3
suggest a way to show a form once when the application is first time run on user PC.
Thanx
 
Here's one way,
You could set up an app config file or a txt file it doesn't really matter, what ever you are most comfortable with using and set a simple boolean value to True i.e

FirstTimeOpening = True

Then when your app is opened it can check this value, if it is true which it will be the first time, you can show your form, as the app is closing you can then adjust this value to false so that when the app opens and checks the value it will be false and won't show your start up form.
 
You obviously need to store a value external to your application to indicate that the application has already been run. The usual way to do this would have been to set a value in the registry. .NET apps are supposed to avoid the registry if possible and use config files instead, so I concur with vis781 and suggest a config file.
 
An app config file automatically generated when you set any of the dynamic properties in an app. So to lay your hands on one you could set a dynamic property then delete it, and there in the solution explorer will be you app config. Or you could just add one from the add new item menu. As for how to use it. An app config file is just pure XML however it does have some limitations. I would suggest you googled it there will be loads of info on it.
 
Back
Top