VB .NET Defining a SpeechItem
Listing 1. This code describes the SpeechItem class. A SpeechItem contains a phrase/value pair and a list of SpeechItems that you want to display when it's active. You want your SpeechItem objects to form a hierarchy, where each SpeechItem contains its own child SpeechItems. Adopting this approach also makes it possible for you to display the text desired on the SpeechButton control, as well as the value you want stored.
Public Class SpeechItem Inherits List(Of SpeechItem) Private _text As String Public Property Text() As String Get Return _text End Get Set(ByVal value As String) _text = value End Set End Property Private _value As String Public Property Value() As String Get Return _value End Get Set(ByVal value As String) _value = value End Set End Property Public Sub New() MyBase.New() Me.Text = String.Empty Me.Value = String.Empty End Sub Public Sub New(ByVal text As String, ByVal _ value As String) MyBase.New() Me.Text = text Me.Value = value End Sub Public Function GetTextItems() As List(Of String) GetTextItems = New List(Of String) For Each si As SpeechItem In Me GetTextItems.Add(si.Text) Next End Function End Class