Luke Berry
Luke Berry

Reputation: 1947

Display a C# message onlyonce

I would like to make a C# application that displays a message when the program starts up, with a button that says "Don't show this message again".

When they click that button, how do I make it not display again the next time the program is ran.

Any and all help would be greatly appreciated.

Also, I'm unsure on how to show a message with a button in it (new to c#) so help on that would be appreciated also.

Upvotes: 5

Views: 890

Answers (4)

kbrimington
kbrimington

Reputation: 25692

As an alternative to user settings, both the registry and isolated storage provide valid places to store your data. One appeal of isolated storage is that you have a whole mini-file-system at your disposal, which can be convenient for very complex storage. In this specific case, however, either user settings or registry settings will provide maximum simplicity, IMO.

Upvotes: 0

Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391724

You just need to record that setting somewhere that lives beyond the current life of the program.

You can use the Settings part of your project for this.

As for adding such a checkbox or whatever, you probably have to create a new form that looks like a message box.

Upvotes: 2

blu
blu

Reputation: 13185

You will have to store a value indicating the whether the user has clicked the box or not in an xml file, database, etc.

Assuming this is WinForms the message will be a MessageBox or a new Form.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039508

You could save this choice in the user settings.

Upvotes: 4

Related Questions