using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Speech.Recognition;using System.Threading;namespace SpeechRecogTest{ public partial class Form1 : Form { SpeechRecognitionEngine sr = new SpeechRecognitionEngine(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //Create grammar Choices words = new Choices(); words.Add("Hi"); words.Add("No"); words.Add("Yes"); Grammar wordsList = new Grammar(new GrammarBuilder(words)); wordsList.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(rec_SpeechRecognized); sr.LoadGrammar(wordsList); } void rec_SpeechRecognized(object sender, RecognitionEventArgs e) { MessageBox.Show(e.Result.Text); } }}