Through the application configaration file You can easily save values to later usage.
you can create a application configuration file from
project > Add New Item (Ctrl + Shift + A)
example
You want to add get string from config file
Create a Config file using above step.
after that insert following code to the config file. its a XML file.
appsettings
add key="DatabasePath" value="c:\\projects\data\spider.mdb"
add key="SupportEmail" value="webmaster-1@dotnetspider.com"
appsettings
configuration
in the coding add following
Dim app As New System.Configuration.AppSettingsReader
Dim s As String
s = app.GetValue("DatabasePath", Type.GetType("System.String"))
MessageBox.Show(s)
its very easy when you are handling databases.
you can store database connection string in that config for later reusabilty.
Please post your comments
you can create a application configuration file from
project > Add New Item (Ctrl + Shift + A)
example
You want to add get string from config file
Create a Config file using above step.
after that insert following code to the config file. its a XML file.
appsettings
add key="DatabasePath" value="c:\\projects\data\spider.mdb"
add key="SupportEmail" value="webmaster-1@dotnetspider.com"
appsettings
configuration
in the coding add following
Dim app As New System.Configuration.AppSettingsReader
Dim s As String
s = app.GetValue("DatabasePath", Type.GetType("System.String"))
MessageBox.Show(s)
its very easy when you are handling databases.
you can store database connection string in that config for later reusabilty.
Please post your comments
Comments
Post a Comment