title: What does "Value does not fall within expected range" mean in runtime error?
body: <p>I'm writing a plugin (dll file) using /clr and trying to implement speech recognition using .NET.
  But when I run it, I got a runtime error saying "Value does not fall within expected range", what does the message mean?</p>
  
  <pre><code>    public ref class Dialog : public System::Windows::Forms::Form
      {
         public: SpeechRecognitionEngine^ sre;
  
         private: System::Void btnSpeak_Click(System::Object^  sender, System::EventArgs^  e) 
         {
           Initialize();
         }
  
         protected: void Initialize()
         {  
            //create the recognition engine
            sre = gcnew SpeechRecognitionEngine();
  
            //set our recognition engine to use the default audio device
            sre-&gt;SetInputToDefaultAudioDevice();
  
            //create a new GrammarBuilder to specify which commands we want to use
            GrammarBuilder^ grammarBuilder = gcnew GrammarBuilder();
  
            //append all the choices we want for commands.
            //we want to be able to move, stop, quit the game, and check for the cake.
            grammarBuilder-&gt;Append(gcnew Choices("play", "stop"));
  
            //create the Grammar from th GrammarBuilder
            Grammar^ customGrammar = gcnew Grammar(grammarBuilder);
  
            //unload any grammars from the recognition engine
            sre-&gt;UnloadAllGrammars();
  
            //load our new Grammar
            sre-&gt;LoadGrammar(customGrammar);
  
            //add an event handler so we get events whenever the engine recognizes spoken commands
            sre-&gt;SpeechRecognized += gcnew EventHandler&lt;SpeechRecognizedEventArgs^&gt; (this, &amp;Dialog::sre_SpeechRecognized);
  
            //set the recognition engine to keep running after recognizing a command.
                //if we had used RecognizeMode.Single, the engine would quite listening after
            //the first recognized command.
            sre-&gt;RecognizeAsync(RecognizeMode::Multiple);
  
            //this-&gt;init();
         }  
  
         void sre_SpeechRecognized(Object^ sender, SpeechRecognizedEventArgs^ e)
         {
            //simple check to see what the result of the recognition was
            if (e-&gt;Result-&gt;Text == "play")
            {
               MessageBox(plugin.hwndParent, L"play", 0, 0);
            }
  
                    if (e-&gt;Result-&gt;Text == "stop")
            {
               MessageBox(plugin.hwndParent, L"stop", 0, 0);
            }
         }
      };
  </code></pre>