Compartir a través de


GetSemanticItem Method

  Microsoft Speech Technologies Homepage

Returns the SemanticItem control with the specified ID.

Markup

SemanticItem = SemanticMap.GetSemanticItem ( id );

Parameters

  • id
    The ID of the SemanticItem.

Return Value

The specified SemanticItem.

Remarks

If the SemanticItem control does not contain a SemanticItem with the specified ID, the GetSemanticItem method returns NULL.

Example

The following example is taken from the C# code in SASDK Obtaining and Validating Dates. In that sample, a Date Application Speech Control stores a day, a month and a year in three SemanticItem controls. When the Date control has collected all three fields, the following routine uses the GetSemanticItem method to access the three fields in order to normalize and localize the date.

private void PastDate_CompleteLast(object sender, System.EventArgs e)
{
    string date = TheSemanticMap.GetSemanticItem("siMonth").Text + "/" +
                  TheSemanticMap.GetSemanticItem("siDay").Text + "/" +
                  TheSemanticMap.GetSemanticItem("siYear").Text;
    System.IFormatProvider dateFormat = new System.Globalization.CultureInfo("en-US", true);
    DateTime tempDate = DateTime.Parse(date, dateFormat, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
    SampleCalendar.SelectedDate = tempDate;
    SampleCalendar.VisibleDate = tempDate;
}

See Also

SemanticMap Class | SemanticMap Constructor | SemanticMap Members | SemanticMap Properties | SemanticMap Methods | SemanticMap Events | SemanticMap Remarks