I'm having a problem with my connection string remaining open on the load of a main form that contains user controls. I can test through and see that my connection string is correct & opened from my main module but when the user control hits InitializeComponent my connection string closes. I was told that I should create a class that contains a shared property that holds the connection string:

Public Class CApplication

Private Shared m_sConnectString As String

Public Shared Property Connectstring() As String
Get
Return m_sConnectString
End Get
Set(ByVal Value As String)
m_sConnectString = Value
End Set
End Property

End Class

and then access the property directly in the class:

Dim cnnConnect as SqlConnection
cnnConnect.ConnectionString = CApplication.ConnectString
cnnConnect.Open

I'm totally confused with what I'm doing. Where do I access the property directly in the class? Does this go in the form load of the user control? How does this work since the connection was originally made in a config file?