MaskedEditBox ValueChanged

2 posts, 0 answers
  1. Mauricio
    Mauricio avatar
    3 posts
    Member since:
    Nov 2011

    Posted 12 Dec 2011 Link to this post

    Hi!

    I've been having trouble with the maskededitbox valuechanged event. Please check the following example:

    Private Sub RadMaskedEditBox1_ValueChanging(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles RadMaskedEditBox1.ValueChanging
     
    MessageBox.Show("Value=" & RadMaskedEditBox1.Value)
     
    End Sub

    It does not show the proper value.

    Also, I'd like to know if there is a way to disable the increase/decrease value using the up/down arrows.
     
    Thanks for your help.
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 15 Dec 2011 Link to this post

    Hi Mauricio,

    Thank you for writing.

    At this moment the value is not changed yet. So it is normal to get the old value in this event.
    You can get the actual value on ValueChanged event. Please refer to code snippet which demonstrates you can cancel the RadMaskedEditBox value based on a certain condition.

    dim oldValue as Object = ""
    Private Sub RadMaskedEditBox1_ValueChanging( sender As System.Object,  e As System.ComponentModel.CancelEventArgs) Handles RadMaskedEditBox1.ValueChanging
            me.oldValue = RadMaskedEditBox1.Value
    End Sub
     'prevent user to enter 7 as single value
    Private Sub RadMaskedEditBox1_ValueChanged( sender As System.Object,  e As System.EventArgs) Handles RadMaskedEditBox1.ValueChanged
      if me.RadMaskedEditBox1.Value = 7 then
                me.RadMaskedEditBox1.Value = oldValue
      End If

    I hope this helps. Kind regards,
    Peter
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top