Getting the date from Datetimepicker issue
I have a form that has a DateTimePicker control on it. The user can select a date and this date is saved to the database when the form opens. I am using the followng code to save it to the DB:
anyRow(
"ContractListStartDate") = ContractListStartDateDateTimePicker.ValueWhen the form is reopened the correct date is displayed in the control. SO everything seems to work fine. However if aI put a line of code in such as below:
MsgBox(ContractListStartDateDateTimePicker.Value)
0 is displayed. Why is this.
What I am ultimately trying to do is find the number of days between today and the selected date, but I always get 0. It seems when I read the dates from the DateTime Picker textbox I am always reading zero even though the textbox shows the correct dates. Here is the code I am using to find the days between dates.
funcCalcDOM = DateDiff(DateInterval.Day, Now, vDate)
Any advice on what I am doing wrong
Sorry, what I meant to say was that
when I put a line of code in such as below: MsgBox(ContractListStartDateDateTimePicker.Value)TODAYS date is displayed. Instead of the date that was previously chosen by the user. This is so, even though the users selected date is being displayed in hte DateTimepicker Text box. So if the DTpicker is showing 04 Oct 2005 the above msg box will display 07 Dec 2005
Any guidance would be appreciated.
SInce I am unable to recreate this issue, I was wondering if you found out what your problem was....Did you have a property setting wrong for the datetime picker? Also if you use Option Strict ON you will have to explicitly cast the value to a string to be shown in the messagebox!