I made a simple test to reproduce my issue:
Create a windows application
Create a new dataset, one table, two fields (RowID Int(Auto, -1,-1);
SomeDate Date)
Add a commandbutton and a textbox to form1
Paste in the following form code:
Private m_dsTest As Dataset1
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTest.Click
Try
Dim dr As Dataset1.SimpeTableRow
Dim b As Binding
dr = m_dsTest.SimpeTable.NewSimpeTableRow
m_dsTest.SimpeTable.AddSimpeTableRow(dr)
b = New Binding("Text", dr, "SomeDate")
AddHandler b.Parse, AddressOf DBdateTextbox
'DataBindingManager.CurrencyStringtoDate
AddHandler b.Format, AddressOf TextBoxDBdate
'DataBindingManager.DateToCurrencyString
Me.txtDate.DataBindings.Add(b)
Catch ex As System.Reflection.TargetInvocationException
Debug.WriteLine("Boom!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" & vbCrLf &
ex.ToString)
Stop
Catch ex As Exception
Debug.WriteLine(ex.ToString)
End Try
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
m_dsTest = New Dataset1
End Sub
Private Sub DBdateTextbox(ByVal sender As Object, ByVal cevent As
ConvertEventArgs)
If cevent.Value Is DBNull.Value Then
cevent.Value = ""
Else
Dim datum As Date
datum = CDate(cevent.Value)
cevent.Value = datum.ToString("d")
End If
End Sub
Private Sub TextBoxDBdate(ByVal sender As Object, ByVal cevent As
ConvertEventArgs)
If cevent.Value.ToString = "" Then
cevent.Value = DBNull.Value
Else
Dim datum As Date
datum = CDate(cevent.Value)
Cevent.Value = datum
End If
End Sub
.................. Data set XML.................
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Dataset1" targetNamespace="
http://tempuri.org/Dataset1.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified" xmlns="
http://tempuri.org/Dataset1.xsd"
xmlns:mstns="
http://tempuri.org/Dataset1.xsd"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="SimpeTable">
<xs:complexType>
<xs:sequence>
<xs:element name="RowID" type="xs:int" minOccurs="0"
msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1"
msdata:AutoIncrementStep="-1" />
<xs:element name="SomeDate" type="xs:date" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="Dataset1Key1">
<xs:selector xpath=".//mstns:SimpeTable" />
<xs:field xpath="mstns:RowID" />
</xs:key>
</xs:element>
</xs:schema>