Property of Mask 1
Property of Mask 2
1st MaskedTextBox have Mask and 2nd have not Mask, rest property are same.
Case 1
when set the mask and value are shown like "HISH_PAT" as MASK 1 text box.(as show in image).
Case 2
when does not set the mask and value are shown like "ASHISH P" as MASK 2 text box (as show in image).
I want to show value like "ASHISH P" as MASK 2 text box (as show in image).
When the Mask is SET, but I do not want to change width of MaskedTextBox.
How to resolve this ?
I just played around bit with the MaskedTextBox
properties and it looks to be default behaviour of the control and co-related with Width
. So when the length of the text to be displayed exceeds proportionate to the width of the control, the text towards end is shown.
I managed to make use of the maskedTextBox.Select
property manually move the to the 1st character of with the below code line;
maskedTextBox1.Select(0, 1);
The above line selects the first character of the control, which enables to show the start of the entered text/ selection. The code should be called from the maskedTextBox1.Leave
event. If your app displays some data at the start of the application/ screen then the same would have to be called from the Form.Load
event as well.