| | |
What is wrong with this code???
![]() |
•
•
Join Date: Feb 2006
Posts: 26
Reputation:
Solved Threads: 0
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Function CheckWord(ByVal Wrd As String) As String Dim i As Integer Dim Pos As Integer Dim Found As Integer Found = 0 For i = 1 To 26 Pos = InStr((Word(i).ToLower), Wrd.ToLower) If Pos <> 0 Then CheckWord = Word(i) Found = 1 End If Next If Found = 0 Then Label2.Caption = "Not match" End If End Function
Last edited by s0312001; Jul 18th, 2006 at 3:39 pm.
Hmn, VB6 doesn't have the .toLower method. It uses an lcase(variablename or string) function...... try switching
to and see how that feels....
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Pos = InStr((Word(i).ToLower), Wrd.ToLower)
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Pos = InStr(lcase(Word(i)), lcase(Wrd))
•
•
Join Date: Feb 2006
Posts: 26
Reputation:
Solved Threads: 0
I tried your code and had a type mismatch error message
something is wrong with this code
something is wrong with this code
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
Label1.Caption = Label1.Caption & CheckWord(Result.PhraseInfo.GetText)
End Sub
Last edited by s0312001; Jul 18th, 2006 at 6:18 pm.
•
•
Join Date: Feb 2006
Posts: 26
Reputation:
Solved Threads: 0
Thanks..here is my code, can you identify my errors...
Dim WithEvents RC As SpInProcRecoContext
Dim Recognizer As SpInprocRecognizer
Dim myGrammar As ISpeechRecoGrammar
Dim Word(26) As String
Private Sub Form_Load()
Set RC = New SpInProcRecoContext
Set Recognizer = RC.Recognizer
Set myGrammar = RC.CreateGrammar
myGrammar.DictationSetState SGDSActive
Dim Category As SpObjectTokenCategory
Set Category = New SpObjectTokenCategory
Category.SetId SpeechCategoryAudioIn
Dim Token As SpObjectToken
Set Token = New SpObjectToken
Token.SetId Category.Default()
Set Recognizer.AudioInput = Token
Word(1) = "Alpha"
Word(2) = "Bravo"
Word(3) = "cat"
Word(4) = "Dog"
Word(5) = "Echo"
Word(6) = "Frank"
Word(7) = "Golf"
Word(8) = "Hotel"
Word(9) = "India"
Word(10) = "Jane"
Word(11) = "Kilo"
Word(12) = "Lima"
Word(13) = "Mike"
Word(14) = "North"
Word(15) = "Oscar"
Word(16) = "Paul"
Word(17) = "Queen"
Word(18) = "Romeo"
Word(19) = "Sierra"
Word(20) = "Tango"
Word(21) = "Under"
Word(22) = "Victor"
Word(23) = "Water"
Word(24) = "Xray"
Word(25) = "Yoyo"
Word(26) = "Zulu"
EH:
If Err.Number Then ShowErrMsg()
End Sub
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
Label1.Caption = Label1.Caption & CheckWord(CStr(Result.PhraseInfo.GetText))
End Sub
EH:
If Err.Number Then ShowErrMsg()
End Sub
Private Sub ShowErrMsg()
' Declare identifiers:
Const NL As String = vbNewLine
Dim T As String
T = "Desc: " & Err.Description & NL
T = T & "Err #: " & Err.Number
MsgBox(T, MsgBoxStyle.Exclamation, "Run-Time Error")
End
End Sub
Function CheckWord(ByVal wrd As Integer) As Integer
Dim Pos As Integer
Dim Found As Integer
Found = 0
For i = 1 To 26
Pos = InStr(LCase(Word(i)), LCase(wrd))
If Pos <> 0 Then
CheckWord = Word(i)
Found = 1
End If
Next
If Found = 0 Then
Label2.Caption = "Not matched"
End If
End Function
End Class
•
•
Join Date: Feb 2006
Posts: 26
Reputation:
Solved Threads: 0
I am using micrososft's Speech SDK 5.1.
You remember the code you helped me with before (that one that works fine)..but it is using an older version of SDK not 5.1, i think it is 4 or 5.
so i couldn't find documentation.
I am trying to develop the same application using 5.1, but the documentation is confusing.
You remember the code you helped me with before (that one that works fine)..but it is using an older version of SDK not 5.1, i think it is 4 or 5.
so i couldn't find documentation.
I am trying to develop the same application using 5.1, but the documentation is confusing.
Last edited by s0312001; Jul 21st, 2006 at 5:23 am.
![]() |
Similar Threads
- Can anyone figure out what is wrong in my program? (C++)
- What did I do wrong? (C++)
- Need help! With changing an equation into code and file opening (C++)
- Please help with login page code behind (ASP.NET)
- please help me!!been trying to trace where ive gone wrong!!! (C)
- Script stores data in wrong MySQL columns (MySQL)
- wrong output (C++)
- What is wrong wtih my css? (JavaScript / DHTML / AJAX)
- merged:nesting loops (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: comatose can you help
- Next Thread: Need some help plzzz
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






