Access MySettings from other Project in Solution

Is it possible to access the My.Settings of an other DLL referenced in the current Project? I have a Database project in which Settings the ConnectionString is stored. I need access to this Setting in an other Project(for Log-File).

Answers


I have helped myself by a class in the Database-Project which has a function getAppSetting:

Public NotInheritable Class Helper
   Private Sub New()
   End Sub

   Public Shared Function getAppSetting(ByVal key As String) As String
       Dim returnValue As Object = My.Settings(key)
       If returnValue Is Nothing Then
           Return String.Empty
       Else
           Return returnValue.ToString
       End If
   End Function
End Class

I can call this function from my other project to get f.e. the ConnectionString.


Have you tried looking at something like the System.Configuration.ConfigurationManager, I know it works for web apps, not sure about database projects.

Then you could get your connection string with a command like:

ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx


Need Your Help

Settings variable in cordova config.xml for plugin installation

cordova cordova-plugins

I have a cordova app which needs several plugins and want to configure it using the config.xml file.

Using Google AdWords API for the Keyword Tool using PHP and Curl?

php curl google-adwords

Does anyone know a quick way to get keyword ideas using the AdWords API using CURL. The URL should be something like https://adwords.google.com/api/adwords/o/v201101/TargetingIdeaService?wsdl, but ...