Hello...
I am creating a CurrencyManager object and setting it like this ...
Code:
Dim cm as CurrencyManager
(...)
'On Open event of form
cm = Me.BindingContext(ds,"tblPersonData")
I am databinding all of my Textbox controls to various fields in
tblPersonData. Everything is working fine using cm.methods (such as
cm.Position = cm.Position+1) until I attempt to format one of my
databind controls.
I have a field in the tblPersonData table that contains a date
(tblPersonData.TermDate). I do not wish to display the time portion of
the date ... so I attempted to format the binding as follows ....
Dim obTermDate as Binding = New
Binding("Text",ds,"tbPersonData.TermDate")
AddHandler obTermDate.Format, AddressOf obTermDate_Format
Me.tbTermDate.DataBindings.Add(obTermDate)
Private Sub obTermDate_Format(ByVal sender as Object, e as
System.Windows.Forms.ConvertEventArgs)
e.Value = Format(e.Value, "MM/dd/yyyy")
End Sub
If I comment out the line
e.Value = Format(e.Value, "MM/dd/yyyy")
The methods of the CurrencyManager object (cm) work fine. When that
line is not commented, the first record of tblPersonData is displayed
with the term date in the correct format. However, the CM.methods are
not working. For example, cm.Position = cm.Position +1 doesnt move to
the next record as it did with that line commented out.
No exception is thrown, and while debugging the code, I see it execute
the CM.methods and move on.
Anyone have any idea on why CM would become disabled when applying a
format to e.Value?
Thanks,
Johnny