Possible Bug? MaskedTextbox and AutoComplete

8 posts, 0 answers
  1. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 19 Nov 2010 Link to this post

    I have a masktextbox set to a numeric mask.  I also have an AutoCompleteSource with a list of numbers set to Append.  If the value appended is the desired value and the user tabs or clicks out of the box, the appended value is not kept and only the value typed in is shown.

    Example when AutoCompleteSource values are  111890, 57869, 42356:
    • User enters  "11".  
    • Textbox value is appended to show "111890".
    • User tabs out of textbox.
    • Textbox value now displays "11".

    Desired scenario:
    • User enters  "11".  
    • Textbox value is appended to show "111890".
    • User tabs out of textbox.
    • Textbox value now displays "111890".

    If the mask type is set to none, the desired scenario is met.

    Please advise.  Is there simply a property I have set incorrectly?  Is this a bug?  Or is not supported/implemented?



  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 20 Nov 2010 Link to this post

    Hello Jason,

    May I ask what version of the controls you are using? I have tested this under the latest version and I am unable to replicate it.

    Here is how I have it set up
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Clear()
    Me.RadMaskedEditBox1.MaskType = MaskType.Numeric
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Add("111890")
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Add("57869")
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Add("42356")
    Me.RadMaskedEditBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
    Me.RadMaskedEditBox1.AutoCompleteMode = AutoCompleteMode.Append

    and after entering 11, it appends the remaining ..1890 and when I tab away, it is left as 111890 which is correct.

    hope this helps
    richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Nov 2010 Link to this post

    Hello,

    How did you get on with this? If it helped, please remember to mark as answer. If you need more assistance, please just let me know. ]
    thanks
    Richard
  5. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 22 Nov 2010 Link to this post

    I had the same settings, except I also had:

    Me.RadMaskedEditBox1.Mask = "#"

    If I removed the mask being set to "#", the tabbing/clicking works as expected.  However, the "value" property returns the previous value, even if I type the full value.  The "text" property does return the correct value.  

    If I keep the mask set to "#", the value and text property are both set correctly.  However, then the tabbing/clicking stops working as expected.
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Nov 2010 Link to this post

    Hello,

    the # mask is as far as I'm aware for use with a mask type of Standard. Have a look at this link.

    To have this working I would advise
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Clear() 
    Me.RadMaskedEditBox1.MaskType = MaskType.Numeric 
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Add("111890"
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Add("57869"
    Me.RadMaskedEditBox1.AutoCompleteCustomSource.Add("42356"
    Me.RadMaskedEditBox1.AutoCompleteSource = AutoCompleteSource.CustomSource 
    Me.RadMaskedEditBox1.AutoCompleteMode = AutoCompleteMode.Append

    and getting the required value by
    Private Sub RadMaskedEditBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadMaskedEditBox1.Leave
        MessageBox.Show(Me.RadMaskedEditBox1.Text)
    End Sub

    hope that helps, but let me know if you have any other questions
    Richard
  7. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 22 Nov 2010 Link to this post

    The "#" mask just for Standard makes sense.  However, the value property should be updated.  According to the documentation, "This property returns user input without the formatting characters.  If you want the input and the formatting characters, use the Textproperty. "

    In the meantime, I have removed the "#" mask value and changed my code to use "text" property.
  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Nov 2010 Link to this post

    Hello,

    I agree that the value property should be updated and it's confusing that it isn't. I'm glad this has solved your issue though. If you found that this has helped, please mark as answer so others can find the solution too.

    Best regards,
    Richard
  9. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 24 Nov 2010 Link to this post

    Hello guys,

    Thank you for writing.

    As per the documentation: "Value: This property returns user input without the formatting characters. If you want the input and the formatting characters, use the Text property."

    This means that when you have a mask for currency (i.e. "C") and you type 5 in the MaskedEditBox control, the value property will return "5" while the Text property will return "$5".

    However, the "#" mask that you have set should allow only one digit (or space) in the mask editor. Since  this is not the case, this means that we have an issue in this scenario. I have logged the issue in our PITS and we will address it in a future release.

    For the time being, as you already found out, you can remove the mask and stay with a Numeric MaskType.

    @Jason Parrish. Thank you for reporting this case. It helped us to discover the issue. Your Telerik points have been updated.

    @Richard. Thank you for the community effort, you points have also been updated.

    Should you guys have any other questions, do not hesitate to write back.

    Sincerely yours,

    Stefan
    the Telerik team

     

    Get started with RadControls for WinForms with numerous videos and detailed documentation.
Back to Top
UI for WinForms is Visual Studio 2017 Ready