ComponentOne Basic Library for UWP
Basic Library Overview / Input for UWP / Input for UWP Task-Based Help / C1MaskedTextBox Task-Based Help / Changing the Prompt Character
In This Topic
    Changing the Prompt Character
    In This Topic

    The C1MaskedTextBox.PromptChar property sets the characters that are used to prompt users in the C1MaskedTextBox control. By default the C1MaskedTextBox.PromptChar property is set to an underline character ("_") but you can customize this. For more details about the C1MaskedTextBox.PromptChar property, see Prompts.

    At Design Time

    To set the C1MaskedTextBox.PromptChar property, complete the following steps:

    1. Click the C1MaskedTextBox control once to select it.
    2. Navigate to the Properties tab and enter "0000" in the text box next to the C1MaskedTextBox.Mask property to set a mask.
    3. In the properties window, enter "#" (the pound character) in the text box next to the C1MaskedTextBox.PromptChar property

    In XAML

    To set the C1MaskedTextBox.PromptChar property add Mask="0000" PromptChar="#" to the <Xaml:C1MaskedTextBox> tag so that it appears similar to the following:

    Markup
    Copy Code
    <Xaml:C1MaskedTextBox Height="23" Name="C1MaskedTextBox1" Width="120" Mask="0000" PromptChar="#"></Xaml:C1MaskedTextBox>
    

    In Code

    To set the C1MaskedTextBox.PromptChar property add the following code to your project:

    Visual Basic
    Copy Code
    Dim x As Char = "#"c
    C1MaskedTextBox1.Mask = "0000"
    C1MaskedTextBox1.PromptChar = x
    

     

    C#
    Copy Code
    char x = '#';
    this.c1MaskedTextBox1.Mask = "0000";
    this.c1MaskedTextBox1.PromptChar = x;
    

    Run your project and observe:

    The pound character will appear as the prompt in the control. In the following image, the number 32 was entered in the control:

     

    See Also