T
Taras
Hi,
I have the problem with binding the textbox with date field in the table of
the dataset.
The problem is that if the entered text in the textbox isn't of the correct
type (for example "dfhd" instead of "12.6.2003"), the text gets
automatically overwritten by the old value. That way the user has to type
everything all over again instead of just correcting the entered value.
Is there a way to prevent old value to overwrite the entered text?
I used the following code to bind the textbox to a dataview...
Dim objBinding As New Binding("Text", ds.NETBill.DefaultView, "Date")
AddHandler objBinding.Format, AddressOf FormatDate
txtDatum.DataBindings.Add(objBinding)
....and following code to validate entered text...
Private Sub txtDatum_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles txtDatum.Validating
If Not ControlValue.CheckValue (txtDate, ControlValue.ETip.tDate,
ds.NETRacun.DefaultView(0)) Then
e.Cancel = True
End If
End Sub
Regards,
Taras
I have the problem with binding the textbox with date field in the table of
the dataset.
The problem is that if the entered text in the textbox isn't of the correct
type (for example "dfhd" instead of "12.6.2003"), the text gets
automatically overwritten by the old value. That way the user has to type
everything all over again instead of just correcting the entered value.
Is there a way to prevent old value to overwrite the entered text?
I used the following code to bind the textbox to a dataview...
Dim objBinding As New Binding("Text", ds.NETBill.DefaultView, "Date")
AddHandler objBinding.Format, AddressOf FormatDate
txtDatum.DataBindings.Add(objBinding)
....and following code to validate entered text...
Private Sub txtDatum_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles txtDatum.Validating
If Not ControlValue.CheckValue (txtDate, ControlValue.ETip.tDate,
ds.NETRacun.DefaultView(0)) Then
e.Cancel = True
End If
End Sub
Regards,
Taras