From: TC on 10 Mar 2010 13:27 I have a config file which contains settings for several projects. How do I read the settings for one project from within another project's code? I'm using Visual Studio 2005 and NET 2.0. -TC
From: Harry Strybos on 10 Mar 2010 15:51 "TC" <existential.philosophy(a)gmail.com> wrote in message news:9ce1deec-af66-44f9-b7cf-8a7aae2af0c3(a)j27g2000yqn.googlegroups.com... > I have a config file which contains settings for several projects. How > do I read the settings for one project from within another project's > code? > > I'm using Visual Studio 2005 and NET 2.0. > > -TC Her's some stuff to look at: Private _config As Configuration Private _appSet As AppSettingsSection If _appSet Is Nothing Then Dim map As New ExeConfigurationFileMap() With {.ExeConfigFilename = Replace(Windows.Forms.Application.StartupPath & "\myapp.exe.config", "\", "\")} _config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None) _appSet = _config.AppSettings End If
From: TC on 11 Mar 2010 12:22 On Mar 10, 12:51 pm, "Harry Strybos" <nos...(a)ffapaysmart.com.au> wrote: > "TC" <existential.philoso...(a)gmail.com> wrote in message > > news:9ce1deec-af66-44f9-b7cf-8a7aae2af0c3(a)j27g2000yqn.googlegroups.com... > > > I have a config file which contains settings for several projects. How > > do I read the settings for one project from within another project's > > code? > > > I'm using Visual Studio 2005 and NET 2.0. > > > -TC > > Her's some stuff to look at: > > Private _config As Configuration > Private _appSet As AppSettingsSection > > If _appSet Is Nothing Then > > Dim map As New ExeConfigurationFileMap() With > {.ExeConfigFilename = Replace(Windows.Forms.Application.StartupPath & > "\myapp.exe.config", "\", "\")} > > _config = > ConfigurationManager.OpenMappedExeConfiguration(map, > ConfigurationUserLevel.None) > > _appSet = _config.AppSettings > > End If Harry, Thank you for the reply. I don't yet understand how your code works, but I'll study it and see if it works for me. -TC
|
Pages: 1 Prev: Add class in datacontext in the datacontext designer Next: Default Event in VB NET |