Tuesday, July 24, 2007

Store and Retrieve Application Settings

I used to store some constant values or messages in Resource file for Web application. It seems a little bit different for Windows application, and I think using this application settings is the alternative.

To Store Settings:

1. Right click on the project file, and select "Properties".

2. Select "Settings" tab.

Here, I've added the connection string, where I select the type to be "(Connection String)". You can also specify the scope as Application or User.

To Retrieve Settings:

You can bind application settings to Windows Forms controls.

1. Select the control, expand the (Application Settings) property, then click on the (PropertyBinding) button to display the Application Settings dialog box below.

2. Select the property that you want to bind to, and select the application settings from the dropdownlist.

OR

You can also select the control, expand the (Application Settings) property, only the bindable property will be shown. Just select the Application Setting that you want to bind from the dropdownlist.

To access the application settings programmatically:

MyExpenseTracker.Properties.Settings.Default.CONNECTIONSTRING

where MyExpenseTracker is the namespace.


OK, the 3 items for last week task have been done. Now, I need to work harder for this week's tasks. Tongue

The other 2 weekly Task for week 16/07/2007 - 22/07/2007:
* How to launch application in Visual Studio 2005?
* DataGridView Prototype

1 comment:

  1. Can anyone recommend the top performing MSP tool for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central software inventory management
    ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

    ReplyDelete