This is a migrated thread and some comments may be shown as answers.

MaskedEditBox ValueChanged

1 Answer 88 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Mauricio
Top achievements
Rank 1
Mauricio asked on 12 Dec 2011, 04:14 PM
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.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Dec 2011, 11:48 AM
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.

Tags
MaskedEditBox
Asked by
Mauricio
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or