when a button is pressed i need to add(append) more grammars to the speech recognition at run time--
recog = New SpeechRecognitionEngine()
recog.SetInputToDefaultAudioDevice()
recog.RecognizeAsyncStop()
recog.UnloadAllGrammars()
Dim commandChoices As New Choices("wordpad", "notepad", "word")
Dim grammarBuilder As New GrammarBuilder(New Choices("open", "close", "Hello"))
grammarBuilder.Append(commandChoices)
Dim commandChoices1 As New Choices("google", "facebook", "yahoo", "apple")
Dim grammarBuilder1 As New GrammarBuilder(New Choices("goto"))
grammarBuilder1.Append(commandChoices1)
Dim grammarbuilder2 As New GrammarBuilder(New Choices("Calculator", "TaskManager", "MyComputer", "CommandPrompt", "C-Panel", "D-Drive", "C-Drive"))
Dim g As New Grammar(New Choices(grammarBuilder, grammarBuilder1, grammarbuilder2))
g.Name = "Available programs"
recog.LoadGrammarAsync(g)
recog.RecognizeAsync(RecognizeMode.Multiple)
AddHandler recog.AudioLevelUpdated, AddressOf Me.auevent
AddHandler recog.SpeechRecognized, AddressOf Me.recevent
AddHandler recog.SpeechRecognitionRejected, AddressOf Me.recfailevent
'My goal to achieve'
if a Button is pressed
add/append "paint" to the commandchoices at runtime. Please Help
recog.RequestRecognizerUpdate()beforerecog.LoadGrammarAsync(g). You have to declare your Grammar as an instance Field (or use a custom manager class) if you have to add more strings to it somewhere else.