Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

anyway regarding the code i post i also got another problem. it is able to recognised the color when i use the mic to speak however i found out that the code change color even when i am saying other word for example i say hi it will change to green.so my question is there anyway that i can only recognise the word i say for example "red" and reject any other word i say like example "hello"? thanks programmer anyway
VB
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim gram As New Recognition.SrgsGrammar.SrgsDocument
        Dim colorRule As New Recognition.SrgsGrammar.SrgsRule("color")
        Dim colorsList As New Recognition.SrgsGrammar.SrgsOneOf("green", "rosy", "white", "yellow", "Peru", "Blue", "red")
        colorRule.Add(colorsList)
        gram.Rules.Add(colorRule)
        gram.Root = colorRule
        reco.LoadGrammar(New Recognition.Grammar(gram))
    End Sub

Private Sub reco_SpeechRecognized(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognitionEventArgs) Handles reco.SpeechRecognized
       Select Case e.Result.Text
           Case "rosy"
               SetColor(Color.RosyBrown)
           Case "green"
               SetColor(Color.Green)
           Case "white"
               SetColor(Color.White)
           Case "yellow"
               SetColor(Color.Yellow)
           Case "Peru"
               SetColor(Color.Peru)
           Case "Blue"
               SetColor(Color.Blue)
           Case "red"
               SetColor(Color.Red)
Posted
Updated 20-Dec-10 15:40pm
v5
Comments
Abdul Quader Mamun 16-Dec-10 21:59pm    
Spelling check.

1 solution

Well, without knowing anything about your project or exactly what you are trying to do... if you want to check a checkbox it's with code like this:

Checkbox1.Checked = True

and if you want to uncheck a checkbox it would be like this:

Checkbox1.Checked = False

So if you have multiple checkboxes you may first want to uncheck all of them, and then based on what keyword is spoken and recognized check the appropriate box.

If you need more help, please be a bit more specific about what you are trying to accomplish, like what checkboxes you have on your form and exactly what needs to happen in order to check them.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900