Ayohaych
Ayohaych

Reputation: 5189

C# Plugin options

So I'm making a plugin for Visual Studio that opens Internet Explorer and goes to a specified website. How can I make it so that you can right click the button or something and bring up options and enter in a new URL that is then saved? Not sure how I can do this! Thanks for any help

Upvotes: 0

Views: 98

Answers (1)

legrandviking
legrandviking

Reputation: 2414

You can create a new setting at design time by using the Settings designer. The Settings designer is a grid-style interface that allows you to create new settings and specify properties for those settings. You must specify Name, Value, Type and Scope for your new settings. Once a setting is created, it is accessible in code.

In Solution Explorer, expand the Properties node of your project. Double-click the .settings file in which you want to add a new setting. The default name for this file is Settings.settings. In the Settings designer, set the Name, Value, Type, and Scope for your setting. Each row represents a single setting.

How to read settings Via the Properties.Settings.Default member. The following example shows how to assign myName setting to a string Name property.

this.Name = Properties.Settings.Default.myName;

How to write settings

Properties.Settings.Default.myName = "Robert"

If you want to persist the changes to the settings between application sessions, call the Save method, as shown below:

Properties.Settings.Default.Save();

Upvotes: 1

Related Questions