HI there guys,
I need help with the following please: The code below is code that is written for a Speech Recognition program. When the user speaks thru a microphone, the code below is triggered and the speech that is recognized is displayed in a textbox. The problem that I have is that I don’t want the text to be displayed in a textbox (txtSpeech in the case below), I want the text to be displayed in a Listbox. The reason why I want the text to be displayed in a ListBx, is because I have developed a
function that compares the text of two ListBoxes –the only problem is that the compare function works great when making use of two ListBoxes, but in this case, the text is displayed in a TextBox…The text that must be change (BELOW) is written in Italics to give you an indication of which code (I think) should change in order to let the text be displayed in a ListBox instead of an Textbox. The name of the textbox used is txtSpeech in the code below. So all I want is for you guys to help me by just give me an indication of how the code should look like when one make use of a ListBox. It is only three lines of code that must be changed – so please guys, I don’t want you to develop my code for me, I am a newbie an are still finding me feet in Visual Basic, so I would appreciate it very much if you could help me with the code, because it is the only way how I could see how to implement a ListBox to do the same function as the TextBox in the code below… Here is the code:
' This function handles Recognition event from the reco context object.
' Recognition event is fired when the speech recognition engines recognizes
' a sequences of words.
Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _
ByVal StreamPosition As Variant, _
ByVal RecognitionType As SpeechRecognitionType, _
ByVal Result As ISpeechRecoResult _
)
Dim strText As String
strText = Result.PhraseInfo.GetText
Debug.Print "Recognition: " & strText & ", " & _
StreamNumber & ", " & StreamPosition
· Now below is the part of the code that must change in order to make use of a ListBox instead of an TextBox (I am not sure if anything above should change also?):
' Append the new text to the text box, and add a space at the end of the
' text so that it looks better
txtSpeech.SelStart = m_cChars
txtSpeech.SelText = strText & " "
m_cChars = m_cChars + 1 + Len(strText)
End Sub
Thanks for your help and precious time…
Best Regards
C-Power
I need help with the following please: The code below is code that is written for a Speech Recognition program. When the user speaks thru a microphone, the code below is triggered and the speech that is recognized is displayed in a textbox. The problem that I have is that I don’t want the text to be displayed in a textbox (txtSpeech in the case below), I want the text to be displayed in a Listbox. The reason why I want the text to be displayed in a ListBx, is because I have developed a
function that compares the text of two ListBoxes –the only problem is that the compare function works great when making use of two ListBoxes, but in this case, the text is displayed in a TextBox…The text that must be change (BELOW) is written in Italics to give you an indication of which code (I think) should change in order to let the text be displayed in a ListBox instead of an Textbox. The name of the textbox used is txtSpeech in the code below. So all I want is for you guys to help me by just give me an indication of how the code should look like when one make use of a ListBox. It is only three lines of code that must be changed – so please guys, I don’t want you to develop my code for me, I am a newbie an are still finding me feet in Visual Basic, so I would appreciate it very much if you could help me with the code, because it is the only way how I could see how to implement a ListBox to do the same function as the TextBox in the code below… Here is the code:
' This function handles Recognition event from the reco context object.
' Recognition event is fired when the speech recognition engines recognizes
' a sequences of words.
Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _
ByVal StreamPosition As Variant, _
ByVal RecognitionType As SpeechRecognitionType, _
ByVal Result As ISpeechRecoResult _
)
Dim strText As String
strText = Result.PhraseInfo.GetText
Debug.Print "Recognition: " & strText & ", " & _
StreamNumber & ", " & StreamPosition
· Now below is the part of the code that must change in order to make use of a ListBox instead of an TextBox (I am not sure if anything above should change also?):
' Append the new text to the text box, and add a space at the end of the
' text so that it looks better
txtSpeech.SelStart = m_cChars
txtSpeech.SelText = strText & " "
m_cChars = m_cChars + 1 + Len(strText)
End Sub
Thanks for your help and precious time…
Best Regards
C-Power