title: Using VB.net and excel (combo box & search)
body: <p>New to programming and need to make a program in VB to interact with the Excel in the background </p>
  
  <p>The Idea is to have two combo boxes, one "country", the other "city" (If country chosen, list of cities would be reduced to that country; if city is chosen, country would be selected automatically);</p>
  
  <p>I have a DataGridView which displays two columns from the excel speadsheet, the person's fist name and the last name.</p>
  
  <p>So given the city or a country/city a list of people would be displayed living in that country.</p>
  
  <p>Also I'm trying to make a searchbox, whereby when you type into a textfield, given what you have typed so far it would filter the first name (containing what you have typed) in the GridView.</p>
  
  <p>So far I have managed to get other things working, such as radiobuttons and checkboxes with different options.</p>
  
  <p>I could not find anything that would work in regards to the comboboxes and the search field (without a button, so "live" filtering process would need to take place).</p>
  
  <p>I am comfortable with SQL so I've been using sql so far to send queries to the excel and retrieve info for the grid view.</p>
  
  <p>Could you please help? (may be provide with the template of how I should code it....)</p>
  
  <hr>
  
  <p>I am using Visual Basic 2012 and OleDB 4.0 (If i'm not mistaken) to make the connection.</p>
  
  <hr>
  
  <p>Given the comments below, the workaround that I've found for the search-bar is to create a button, then make it as small as possible and hide it behind the search bar by 'sending it to the back' as making it invisible seemed to have disabled it completely...</p>
  
  <p>Then I have used the below code for the button:</p>
  
  <pre><code>    Private Sub BtSearch_Click(sender As Object, e As EventArgs) Handles BtSearch.Click
  
      Try
          FillSearchResults("SELECT First_Name, Last_Name FROM [Database$] WHERE Country LIKE '%" &amp; Country.Text &amp; "%'")
          Country.Text = dt.Rows(0).Item(1)
  
      Catch ex As Exception
          MsgBox("Not Found")
      End Try
  
  End Sub
  </code></pre>
  
  <p>And for the text Field (to make the search results come up when the user hits Enter):</p>
  
  <pre><code>Private Sub CountrySearch_TextChanged(sender As Object, e As EventArgs) Handles CountrySearch.TextChanged
  
      Me.AcceptButton = BtSearch
  
  End Sub
  </code></pre>
  
  <p>Next step: I will probably try to apply the filter so that the user wouldn't have to hit enter for the grid view to update</p>
  
  <hr>
  
  <p>Any development I will post here, so that as suggested, if anyone else has the same problem, it would be clearer to see follow...</p>