I want to add a button to my form that sets the value of a custom
DateTimeEditor to the current date.
I currently have this code:
Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal Args As
System.EventArgs) Handles btnEpiCustom1.Click
'// ** Place Event Handling Code Here **
dteEpiCustom1 =
CType(csm.GetNativeControlReference("eb535b85-b324-4ea7-afe8-3b6b03e4afa
5"), EpiDateTimeEditor)
dteEpiCustom1.DateTime = DateTime.Now()
End Sub
However if I attempt to Save the form, nothing happens, and the data
is lost. If I manually pick the date the form behaves as expected and
the data is persisted. I tried invoking a couple of other methods on
the control but that doesn't work.
So I thought to try manipulating the EpiDataView and tried this
instead for the click event:
Dim edvPartPlant As EpiDataView =
CType(oTrans.EpiDataViews("PartPlant"), EpiDataView)
Dim ppDate01 As DateTime =
edvPartPlant.dataView(edvPartPlant.Row)("Date01")
ppDate01 = DateTime.Now
This works as expected, but if the column is null I get this error
when I tab out of the field when I click the button:
System.InvalidCastException: Conversion from type 'DBNull' to type
'Date' is not valid.
I'm not sure how to handle this in Vantage. There are various ways
generically, but I'm not sure what the client is doing and at what
point.
-bws
--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix
bspolarich@...
<mailto:bspolarich@...> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>
[Non-text portions of this message have been removed]
DateTimeEditor to the current date.
I currently have this code:
Private Sub btnEpiCustom1_Click(ByVal Sender As Object, ByVal Args As
System.EventArgs) Handles btnEpiCustom1.Click
'// ** Place Event Handling Code Here **
dteEpiCustom1 =
CType(csm.GetNativeControlReference("eb535b85-b324-4ea7-afe8-3b6b03e4afa
5"), EpiDateTimeEditor)
dteEpiCustom1.DateTime = DateTime.Now()
End Sub
However if I attempt to Save the form, nothing happens, and the data
is lost. If I manually pick the date the form behaves as expected and
the data is persisted. I tried invoking a couple of other methods on
the control but that doesn't work.
So I thought to try manipulating the EpiDataView and tried this
instead for the click event:
Dim edvPartPlant As EpiDataView =
CType(oTrans.EpiDataViews("PartPlant"), EpiDataView)
Dim ppDate01 As DateTime =
edvPartPlant.dataView(edvPartPlant.Row)("Date01")
ppDate01 = DateTime.Now
This works as expected, but if the column is null I get this error
when I tab out of the field when I click the button:
System.InvalidCastException: Conversion from type 'DBNull' to type
'Date' is not valid.
I'm not sure how to handle this in Vantage. There are various ways
generically, but I'm not sure what the client is doing and at what
point.
-bws
--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix
bspolarich@...
<mailto:bspolarich@...> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>
[Non-text portions of this message have been removed]