Hi,
i've got a form with a MaskedTextBox and some other control, which i
used to make the MaskTextBox loose focus.
The MaskedTextBox is databound to a property named "Text" on a Custom
Class, which is a business object. This is the code for the class:
________________________________________________________________
Public Class Class1
Private mText As String = "dlsf"
Public Property Text() As String
Get
Return mText
End Get
Set(ByVal value As String)
mText = value
RaiseEvent TextChanged(Me, System.EventArgs.Empty)
End Set
End Property
Public Event TextChanged As System.EventHandler
End Class
_______________________________________________________________
My MaskedEditBox is initialized and databinding is setup with the
following code in the contructor of the form
_______________________________________________________________
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
mClass1 = New Class1()
MaskedTextBox1.Mask = "0000-00-00"
MaskedTextBox1.ValidatingType = GetType(Date)
MaskedTextBox1.DataBindings.Add("Text", mClass1, "Text", True,
DataSourceUpdateMode.OnValidation)
End Sub
_______________________________________________________________
My problem is that i can't prevent incomplete values, that the user
enters into the MaskedTextBox1, from being forwarded into my business
object (the Set property of Text). I've tried experimenting with the
MaskedTextBox's Validated,Validating, and TypeValidationCompleted
events but with no success.
Is there some way to prevent the control from updating the datasource
when i know the value is incomplete/incorrect?
|