title: Searching a DataGridView for a match or partial match
body: <p>Tried to sift through the google results; no luck. What I'm trying to do is, given some text in a TextBox: search for at least a partial match in any column of my DataGridView, and have the control select the first row (show it as the top row and have it highlighted) that it encounters with that partial match.</p>
  
  <p>Here is my declaration of the DataSource for the DataGridView and how the columns are organized:</p>
  
  <pre><code> var queryData = from va in xdoc.Descendants("language")
                      select new
                      {
                          StringID = va.Parent.Parent.Attribute("id").Value,
                          Language = va.Attribute("name").Value,
                          LanguageData = va.Element("value").Value,
                      };
  
          var organizedData = from x in queryData
                       group x by x.StringID into xg
                       select new
                       {
                           StringID = xg.Key,
                           English = xg.SingleOrDefault(x =&gt; x.Language == "ENGLISH_US").LanguageData,
                           Custom = xg.SingleOrDefault(x =&gt; x.Language == languageBox.SelectedItem.ToString()).LanguageData,
                       };
  
          mainView.DataSource = organizedData.ToList();
  </code></pre>
  
  <p>And here is the current definition of the function that handles a click of the 'Search' button:</p>
  
  <pre><code>private void searchButton_Click(object sender, EventArgs e)
      {
          int currentIndex = mainView.CurrentRow.Index;
  
          if (searchBox.Text.Length == 0)
          {
              mainView.CurrentCell = mainView[0,0];
              mainView.Focus();
              return;
          }
      }
  </code></pre>