title: Global access for user's File
body: <p>following code implements an Access-Connection using an OpenFileDialog.
  My Question:
  How should I change the class in order to use this Access-Connection at each point in each formular. Unfortunatley, C# doesn't use global variables.....</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Data.OleDb;
  using System.Windows.Forms;
  using System.IO;
  
  namespace Access
  {
      public class AccessConnection
      {
          OpenFileDialog ofd = new OpenFileDialog();
  
          public string Verbinden()
              {
          string path = @"C:\Users\Projects\C#\C#_GUI\ACCESS_DataGrid";
                  if (Directory.Exists(path)) ofd.InitialDirectory = @"C:\Users\ACCESS_DataGrid";
                  else ofd.InitialDirectory = "C:\\";
                  ofd.Filter = "Accesdatenbanken|*.mdb";
                  string connection = "";
                  if (MessageBox.Show("\tLoad Access-Database now?", "Title", MessageBoxButtons.YesNo) == DialogResult.Yes)
                  {
                      if (ofd.ShowDialog() == DialogResult.OK)
                      {
                          connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + ofd.FileName;
                      }
                      else Application.Exit();
                  }
                  else Application.Exit();
  
              return connection;
              }
      }
  
  }
  </code></pre>