This documentation is archived and is not being maintained.

Changing the Value of Dynamic Properties

Visual Studio .NET 2003

You change the value of a dynamic property after deployment by modifying the configuration file in which the property value was stored. You can modify the configuration file by double-clicking it in Solution Explorer, or by opening it in any editor from the application's deployed location. Depending on whether you are working with a Windows application or a Web application, your configuration file will be named differently:

  • If you are using a Windows application, the design-time configuration file will be named app.config. After your project is compiled and deployed, the file will be copied to the bin directory and renamed to assembly.config, where assembly is the name of your project's assembly.
  • If you are using a Web application, the information about dynamic properties is stored in AppSettings section of the Web.config file.

After making the change to the configuration file, the new property value will be incorporated the next time you start your application.

For example, suppose you have an instance of the EventLog component that you have connected to a custom log called Orders, and now you want to switch it to a different log called ProcessedOrders. The component instance's Log property was dynamically stored in the .config file, which would currently indicate the following:

<add key="eventLog1.Log" value="Orders" />

To change this, you would pull up the configuration file and change the value as follows:

<add key="eventLog1.Log" value="ProcessedOrders" />

To make a change to the value of a dynamic property after deploying your application

  1. In an editor, open the configuration file for your application.
  2. Locate the line that contains the property and value you want to modify. The line should look like this:
    <add key="Component.Property" value="currentvalue" />

    where Component is the name of the control or other element on which the property occurs, and Property is the name of the property whose value is being stored. currentvalue is the stored value for the property.

  3. Modify the currentvalue portion of the statement to the new value you want to use.
  4. Save and close the file.
  5. Restart your deployed application.

    The new value will be updated automatically.

    Note   If you are working in a Web application, the application will automatically restart as soon as you modify the configuration file.

See Also

Introduction to Dynamic Properties | Setting Dynamic Properties | Removing Keys from Properties | Walkthrough: Storing and Retrieving Dynamic Properties