title: Adding words for Speech Recognition in For loop
body: <p>I'm tryng to add words in GrammarBuilder from datagridview...</p>
  
  <pre><code>List&lt;string&gt; grammerList = new List&lt;string&gt;();                           
  
  public myForm()
  {
      InitializeComponent();
      recognizer = new SpeechRecognitionEngine();
      InitializeSpeechRecognitionEngine();
  }
  
  private void InitializeSpeechRecognitionEngine()
  {
      recognizer.SetInputToDefaultAudioDevice();
      Grammar customGrammar = CreateCustomGrammar();
      recognizer.LoadGrammar(customGrammar);
      recognizer.SpeechRecognized += new EventHandler&lt;SpeechRecognizedEventArgs&gt;(
          recognizer_SpeechRecognized);
  }
  
  private Grammar CreateCustomGrammar()
  {
      DataTable myTable = new DataTable();
      OleDbConnection myConnection = new OleDbConnection(connection);
      OleDbCommand myCommand = new OleDbCommand("Select * From wordtable", myConnection);
      OleDbDataAdapter adapter = new OleDbDataAdapter(myCommand);
      adapter.Fill(myTable);
  
      for (ctr = 1; ctr &lt; myTable.RowCount; ctr++)
          grammerList.Add(myTable.Rows[ctr].Cells[0].Value.ToString());
  
      Choices mychoices = new Choices(grammerList.ToArray());
      GrammarBuilder myGrammarBuilder = new GrammarBuilder(c);
      Grammar myGrammar = new Grammar(myGrammarBuilder);
      return myGrammar; 
  }
  </code></pre>
  
  <p>However an error is returned :
  Object reference not set to an instance of an object.</p>
  
  <pre><code>grammerList.Add(myTable.Rows[ctr].Cells[0].Value.ToString());
  </code></pre>
  
  <p>RecognitionEngine is different from recognizer, right?
  RecognitionEngine is c#'s recognizer, SpeechRecognizer is Windows' recognizer right?</p>