VB .NET • Design the SpeechDemo Form
Listing 4. The SpeechDemo form is the final part of the puzzle. This form is somewhat more complicated than other parts of the sample application. This complexity stems from the fact that it incorporates multiple constant buttons, and you need to be able to determine through code which constant button raises a given event. Apart from this aspect, the code for the form is straightforward. ![]() Private Sub SpeechPanelDemo_Load(ByVal sender As _ Object, ByVal e As System.EventArgs) _ Handles Me.Load SpeechPanel1.StartListening() End Sub Private Sub SpeechPanel1_ConstantButtonClicked( _ ByVal sender As Object, ByVal e As _ System.EventArgs) Handles _ SpeechPanel1.ConstantButtonClicked ShowDataAndResetPanel() End Sub Private Sub SpeechPanel1_EndOfLogicTree() Handles _ SpeechPanel1.EndOfLogicTree ShowDataAndResetPanel() End Sub Private Sub ShowDataAndResetPanel() With SpeechPanel1 MessageBox.Show(.GetTextResults) .ClearResults() .ReturnToRoot() End With End Sub |