Changing the Prompt Character

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

At Design Time in Blend

To set the PromptChar property at in Blend, 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 Mask property to set a mask.

3.   In the properties window, enter "#" (the pound character) in the text box next to the PromptChar property

In XAML

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

<c1:C1MaskedTextBox Height="23" Name="C1MaskedTextBox1" Width="120" Mask="0000" PromptChar="#"></c1:C1MaskedTextBox>

In Code

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

      Visual Basic

      C#

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:

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.