Dynamic Visual Basic. NET supports dynamic properties, whose dynamic properties are stored in an application configuration file that will be read when the application executes. You can use dynamic properties to change some property values without recompiling the application. You can use them to save database connection strings, application log information, or server connection information.
To see the example of a dynamic property, first create a Windows application in Visual Basic. Add a textbox to the default form, make sure that the TextBox is selected, and then locate the dynamic property in the Properties window.
Click the ellipsis button next to the Advanced tab to open a dialog box that lists all the properties of the textbox, selects the Text property, and the key mapping box will be activated. The key mapping determines the value that the key stores in the configuration file. Click OK to close the dialog box.
The following code is generated in the InitializeComponent method (located in the Windows Form Designer generating code area). This code cannot be modified directly, only using the Properties window.
Dim Configurationappsettings As _
System.Configuration.AppSettingsReader = _
New System.Configuration.AppSettingsReader ()
When the application is compiled, the file is renamed to Assembly.config, where assembly is the name of your compiled application. If you want to change these values, there is no need to recompile the program, as long as a simple edit configuration file in which to modify the corresponding value.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service