Hi,
when I click into a MaskedEdit with a UserSpecifiedMask e.g. like "CCCCCC" the cursor will appear at exact the point where I clicked as long as it was somewhere in the range of the specified mask. I want to have the cursor always at the first left position. I tried to set the paddingChar to "" but that is not possible. Is there another way to suppress the padding?
Thanks in advance,
Anja
Hi Anja,
Padding is not related to the cursor position as far as I see.
What you need to do is set the SelectionStart property on the control. This controls the position of the cursor. I would probably try using the Enter event.
Hi, Mike,
I tried your solution. It doesn't work for me. The cursor is still at where I click. The InputMask is (999) 999-9999 Ext. 9999999999, and here is the code in the Enter event. Could you help me out? Thank you.
Private Sub txtPhoneNumber_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPhoneNumber.Enter Dim myEditor As Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit = CType(sender, Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit)
myEditor.SelectionStart = 0 End Sub
If it doesn't work inside the Enter event, then it's most likely a timing issue. If that's the case, then you can work around it using BeginInvoke.
Private Sub UltraMaskedEdit1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UltraMaskedEdit1.Enter Me.BeginInvoke(New MethodInvoker(AddressOf Me.SetSelectionStart)) End Sub Private Sub SetSelectionStart() Me.UltraMaskedEdit1.SelectionStart = 0 End Sub
Thank you very much! Mike,
The work-around does the trick.