Got the solution:
In my application I added:
Dim config As System.Configuration.Configuration =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
config.AppSettings.Settings.Add("SQLConnectionString", "The-Conn-String")
config.Save(System.Configuration.ConfigurationSaveMode.Modified)
ConfigurationManager.RefreshSection("appSettings")
And in my control:
_SQLConnectionString =
System.Configuration.ConfigurationSettings.AppSettings("SQLConnectionString")
Somewhat awkward solution, could've been a bit simpler but there we go.
BR,
GAZ
[quoted text, click to view] "GAZ" <gaz@gaz.com> wrote in message
news:%23uUgT%23WrGHA.4944@TK2MSFTNGP04.phx.gbl...
> Hello all,
>
> We have a bit of a problem with application settings and user control. In
> short, we have developed a user control that should, as it happenes, get a
> value stored in application settings of its host application. The
> app.config of the host application looks like this:
>
> <appSettings>
> <add key="SQLConnectionString" value="some value" />
> </appSettings>
>
> <userSettings>
> <Test_Control_Library.My.MySettings>
> <setting name="UserSQL" serializeAs="String">
> <value>User</value>
> </setting>
> </Test_Control_Library.My.MySettings>
> </userSettings>
>
>
> Now, our control can read the SQLConnectionString value from <appSettings>
> by using:
>
>
> System.Configuration.ConfigurationSettings.AppSettings("SQLConnectionString")
>
> However, what we really need to get is the value stored in the UserSQL
> setting under <userSettings> and we haven't got a foggiest how to do it.
> The reason behind using user settings is that the UserSQL value can change
> during the course of work and hence all controls should reflect that
> change.
>
> Any help would be greatly appreciated.
>
> BR,
>
> GAZ
>