Share via


PromptBuilder.SetText Method (String, Object[])

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Replaces all contents of a PromptBuilder with the specified text.

Namespace: Microsoft.SpeechServer.Synthesis
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)

Syntax

'Declaration
Public Sub SetText ( _
    textToSpeak As String, _
    ParamArray args As Object() _
)
public void SetText (
    string textToSpeak,
    params Object[] args
)

Parameters

  • textToSpeak
    The text to speak.
  • args
    An array containing text elements that can be referenced from textToSpeak.

Remarks

SetText replaces all existing content of the PromptBuilder object. For this reason, it cannot follow a call to StartParagraph, StartSentence, StartStyle, or StartVoice on the same PromptBuilder. To specify text in a PromptBuilder following one or more of these methods, call AppendText.

PromptBuilder does not have a GetText method that corresponds to SetText. To get the contents of a PromptBuilder, use the ToXml method.

Example

using Microsoft.SpeechServer.Synthesis;
. . .
        PromptBuilder pb;
        string[] choices = { "orange", "lemon", "lime", "grapefruit" };
. . .
        private void statementActivity1_TurnStarting(object sender, TurnStartingEventArgs e)
        {
            pb = new PromptBuilder();
            pb.AppendText("You can select {0}, {1}, {2}, or {3}", choices);
            statementActivity1.MainPrompt.AppendPromptBuilder(pb);
        }

        private void statementActivity2_TurnStarting(object sender, TurnStartingEventArgs e)
        {
            statementActivity2.MainPrompt.SetText("You can select {0}, {1}, {2}, or {3}", choices);
        }

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

Windows Server 2003

See Also

Reference

PromptBuilder Class
PromptBuilder Members
Microsoft.SpeechServer.Synthesis Namespace