Rob,
If M, D, an Y are integers, why not simply use the constructor for DateTime?
Something like:
Dim month, day, year As Integer
month = dud_Month.SelectedIndex
day = nun_Day.Value
year = nun_Year.Value
Dim inputDate As New DateTime(year, month, day)
If DateTime.Compare(inputDate, DateTime.Today) > 0 Then
' date is in the future
End If
For details on the DateTime constructor & DateTime.COmpare see the on-line
help for the DateTime Structure. Remember that Date is an alias for
System.DateTime.
Hope this helps
Jay
"Rob Bradford" <ro**********@lvirgin.net> wrote in message
news:3c********************************@4ax.com...
All.
I have three variables M, D, and Y that take input from DomainUpDown
(prefix dud_) and NumericUpDown (prefix nud_). How do I cast these
into a valid date-time data type?
The DomainUPDown contains full month naes as text, eg January,
February, ect.
Dim Input_Date As Date
M = dud_Month.SelectedIndex
D = nun_Day.Value
Y = nun_Year.Value
These lines complie but fail at runtime.
Input_Date = DateValue(Dud_Month.Name + "/" + CStr(Nud_Day.Value) +
"," + CStr(Nud_Year.Value))
Input_Date = DateValue(Cstr(Y +1)+ "/" + CStr(D) + "/" + CStr(Y))
The idea is to compate the constructed date (using datediff) with
today too see if a future date has been selected.
Any suggestions would be welcome.
Rob.B