title: TextBox AutoComplete from MDB
body: <p>I have a  .Net 4 Windows Forms app that uses a Microsoft Access Database with one table which has three columns CityCode, Name and Country.</p>
  
  <p>What I want to do is have an autocomplete which shows the “Name” and “Country” but when selected the “CityCode”  Value is shown in the textbox. In addition if the user types A City Code eg LAX as they type L it would list all the cities whose code or Name starts with L.</p>
  
  <p>Can this be done?</p>
  
  <p>Currently I have the following for access the database (but it seems to be a bit slow!)</p>
  
  <pre><code>textBoxCity.AutoCompleteCustomSource = CityList(); 
  
  public static AutoCompleteStringCollection CityList()
      {
          string connectionStringLD = string.Empty;
  
              connectionStringLD = @"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\CityList.mdb";
  
  
          string SQL = "SELECT CityCode from CityTable";
  
          OdbcConnection conn = new OdbcConnection(connectionStringLD);
  
          OdbcCommand cmd = new OdbcCommand(SQL);
          cmd.Connection = conn;
  
          conn.Open();
  
          OdbcDataReader reader = cmd.ExecuteReader();
          AutoCompleteStringCollection theCityList = new AutoCompleteStringCollection();
  
          while (reader.Read())   
          {
  
              theCityList.Add(reader.GetValue(0).ToString());
  
          }
  
          return theCityList;
      }
  </code></pre>