title: How to create global object in VB NET
body: <p>I'm triying to build a language dictionary in VB NET in order to be able to have several languages in the application.</p>
  
  <p>This dictionary has a init method that loads from database the entire dictionary and stores it in memory.</p>
  
  <p>In the rest of the classes of the project, I added the reference and I can use directly the object without create a new instance because their methods are shared.</p>
  
  <p>My question is how i have to load the dictionary content in order that the rest of classes only accessing to Language.GetWord method obtains the properly record of the collection, same way as My.Settings class.</p>
  
  <p>When My.Settings is used from any class the values are loaded. I'm looking for the same effect.</p>
  
  <p>This is the code of the class:</p>
  
  <pre><code>Public Class LanguageProvider
      Private Shared CurrentLanguage As Collection
  
      Public Shared ReadOnly Property GetWord(ByVal Label As String)
          Get
              Try
                  Return CurrentLanguage.Item(Label)
              Catch ex As Exception
                  Return Label
              End Try
          End Get
      End Property
      Public Shared Sub LoadLanguage(ByVal CultureId As Integer)
          Dim SQLController As New SqlDataAccessController
          SQLController.SQLSentence = "SELECT DNF_CULTURE_LANGUAGE_LABELS.LABEL, DNF_CULTURE_LANGUAGE_LABELS.VALUE FROM DNF_CULTURE_LANGUAGE_LABELS WHERE DNF_CULTURE_LANGUAGE_LABELS.CULTUREID = " &amp; CultureId &amp; " ORDER BY LABEL;"
  
          SQLController.OpenConnection()
          Dim dr As SqlClient.SqlDataReader
          dr = SQLController.GetData()
  
          CurrentLanguage = New Collection
  
          While dr.Read()
              CurrentLanguage.Add(dr.Item("Value"), dr.Item("Label"))
          End While
  
          dr.Close()
          SQLController.CloseConnection()
      End Sub
  End Class
  </code></pre>
  
  <p>Function LoadLanguage must be called when the application loads, in order to access once to database. </p>
  
  <p>After that property GetWord must access to the collection with the words and return the result. The problem is that the instances are not the same and the dictionary is not loaded when a class uses it.</p>
  
  <p>Thanks.</p>