Click here to Skip to main content
15,896,063 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Multiline textbox Pin
Nagy Vilmos13-Jun-09 21:15
professionalNagy Vilmos13-Jun-09 21:15 
QuestionCustom made user control won't drop down in TableLayoutPanel, otherwise its perfect! Pin
binjafar8-Jun-09 20:27
binjafar8-Jun-09 20:27 
AnswerRe: Custom made user control won't drop down in TableLayoutPanel, otherwise its perfect! Pin
Henry Minute9-Jun-09 0:38
Henry Minute9-Jun-09 0:38 
GeneralRe: Custom made user control won't drop down in TableLayoutPanel, otherwise its perfect! Pin
binjafar9-Jun-09 1:21
binjafar9-Jun-09 1:21 
GeneralRe: Custom made user control won't drop down in TableLayoutPanel, otherwise its perfect! Pin
Henry Minute9-Jun-09 2:41
Henry Minute9-Jun-09 2:41 
Questioni want know more about ntgraph control Pin
sunilp5728-Jun-09 20:01
sunilp5728-Jun-09 20:01 
AnswerRe: i want know more about ntgraph control Pin
Nagy Vilmos8-Jun-09 21:40
professionalNagy Vilmos8-Jun-09 21:40 
QuestionDictation grammar???? Pin
Speedular8-Jun-09 12:20
Speedular8-Jun-09 12:20 
Good day to all
I have this problem with the code below; I want the system to simply write what it hears with out using the grammar. is there any way to do that?
I've tried removing the grammar file but it did not work.
any help or suggestions


'Default Imports
Imports System
Imports System.Data
Imports System.Deployment
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Xml

'Custom Imports
Imports SpeechLib

Public Class Form1
    'Declares

    Dim WithEvents RecoContext As SpSharedRecoContext       'The Main Recognition Object Used throughout the whole program. -- Shared Object: More Info on this later.
    Dim Grammar As ISpeechRecoGrammar                       'The Grammar Object so the program knows what is going on. -- Instanced Object: More Info on this later.
    Dim CharCount As Integer                                'This is used to count the amount of chars that are in the text box.



    ''''Subs Start Here
    'Start Button. This will engage reco, and start the entire process.
    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

        'First check to see if reco has been loaded before. If not lets load it.
        If (RecoContext Is Nothing) Then
            RecoContext = New SpSharedRecoContextClass          'Create a new Reco Context Class

            Grammar = RecoContext.CreateGrammar(1)              'Setup the Grammar
            Grammar.DictationLoad()                             'Load the Grammar
        End If

        lblStatus.Text = "Recognition Started"                  'Change the Label to let the user know whats up
        Grammar.DictationSetState(SpeechRuleState.SGDSActive)   'Turns on the Recognition. This is Vitally important

        'This is so the user doesn't break the program by 
        'trying to start the recognition after its already started.
        btnStart.Enabled = False
        btnStop.Enabled = True
    End Sub


    ''''


    'Stop Button. This will stop stop the recoginition
    Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click

        Grammar.DictationSetState(SpeechRuleState.SGDSInactive) 'Turns off the Recognition. It will go dormant.
        lblStatus.Text = "Recognition Stopped"                  'Change the label to let the user know whats up

        'Again This is so the user doesn't go breaking things accidently
        btnStart.Enabled = True
        btnStop.Enabled = False
    End Sub


    ''''


    'This is the hypothesis sub. The hypothesis is not the final recognition. This will fire many times per word. You do not want to print anything that is final from the hypothesis.
    'This is not required for the final recognition. But it is vital to understand it.
    Private Sub OnHypo(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal Result As ISpeechRecoResult) Handles RecoContext.Hypothesis

        btnStop.Enabled = False    'Don't allow the user to stop the recognition until it has completed.
        'The button will re-enable in the OnReco Event

        'This is so you don't kepp printing the same text over and over. It could take up just a tiny bit more processor power
        'Its good to not do un-needed things.
        If lblStatus.Text <> "Receiving" Then
            lblStatus.Text = "Receiving"
        End If
    End Sub


    ''''


    'This sub is fired when the reco engine detects a set of words. This is what you want to use to print or sendkey.
    'Use this sub for the final printing of words.
    Private Sub OnReco(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechRecognitionType, ByVal Result As ISpeechRecoResult) Handles RecoContext.Recognition

        Dim recoResult As String = Result.PhraseInfo.GetText 'Create a new string, and assign the recognized text to it.

        'This block will print to the textbox built into the program
        'If you would prefer to use the SendKeys method, Comment out this entire block. And Uncomment the SendKeys Line.
        txtBox.SelectionStart = CharCount
        txtBox.SelectedText = recoResult & " "
        CharCount = CharCount + 1 + Len(recoResult)

        'Uncomment the next line if you want to send the text to the selected window rather than constrain it to the textbox.
        'SendKeys.Send(recoResult & " ") 'This line sends the result via SendKeys to the top window.

        lblStatus.Text = "Finished Dictating"
        btnStop.Enabled = True
    End Sub

End Class

AnswerRe: Dictation grammar???? Pin
_Damian S_8-Jun-09 20:16
professional_Damian S_8-Jun-09 20:16 
GeneralRe: Dictation grammar???? Pin
Speedular9-Jun-09 22:49
Speedular9-Jun-09 22:49 
QuestionForm Initialize Method Pin
vhassan8-Jun-09 2:57
vhassan8-Jun-09 2:57 
AnswerRe: Form Initialize Method Pin
Dave Kreskowiak8-Jun-09 3:35
mveDave Kreskowiak8-Jun-09 3:35 
GeneralRe: Form Initialize Method Pin
vhassan8-Jun-09 17:34
vhassan8-Jun-09 17:34 
GeneralRe: Form Initialize Method Pin
Christian Graus8-Jun-09 17:35
protectorChristian Graus8-Jun-09 17:35 
GeneralRe: Form Initialize Method Pin
Dave Kreskowiak9-Jun-09 3:10
mveDave Kreskowiak9-Jun-09 3:10 
GeneralRe: Form Initialize Method Pin
Dave Kreskowiak9-Jun-09 3:10
mveDave Kreskowiak9-Jun-09 3:10 
QuestionVB6.0 Applicaiton OCX Control Dependency Pin
vhassan8-Jun-09 2:33
vhassan8-Jun-09 2:33 
AnswerRe: VB6.0 Applicaiton OCX Control Dependency Pin
Dave Kreskowiak8-Jun-09 3:34
mveDave Kreskowiak8-Jun-09 3:34 
QuestionCreate a Brush object with defined/displayed color Pin
nishkarsh_k8-Jun-09 1:21
nishkarsh_k8-Jun-09 1:21 
AnswerRe: Create a Brush object with defined/displayed color Pin
JR2128-Jun-09 1:37
JR2128-Jun-09 1:37 
QuestionMessage Closed Pin
8-Jun-09 0:42
tiagu8-Jun-09 0:42 
AnswerRe: How to remove domainupdown control in vb.net Pin
DidiKunz8-Jun-09 1:18
DidiKunz8-Jun-09 1:18 
GeneralRe: How to remove domainupdown control in vb.net Pin
tiagu8-Jun-09 3:10
tiagu8-Jun-09 3:10 
GeneralRe: How to remove domainupdown control in vb.net Pin
DidiKunz8-Jun-09 4:17
DidiKunz8-Jun-09 4:17 
AnswerRe: How to remove domainupdown control in vb.net Pin
Johan Hakkesteegt8-Jun-09 3:15
Johan Hakkesteegt8-Jun-09 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.