Reputation: 97
Currently I am looking at retrieving payments from a OLEDB Database, using quarters of the financial year.
The retrieval of the quarters works, but the part which doesnt is the year part. As shown below
Public Q1 As Date = Date.FromOADate(31 / 3 / 2014)
Public Q2 As Date = Date.FromOADate(30 / 6 / 2014)
Public Q3 As Date = Date.FromOADate(30 / 9 / 2014)
Public Q4 As Date = Date.FromOADate(31 / 12 / 2014)
Is what I currently use, but I would much rather the year to be a variable which can be retrieved from a combobox selection. Like so
Public Q1 As Date = Date.FromOADate(31 / 3 / Yearcombox.Text)
Public Q2 As Date = Date.FromOADate(30 / 6 / Yearcombox.Text)
Public Q3 As Date = Date.FromOADate(30 / 9 / Yearcombox.Text)
Public Q4 As Date = Date.FromOADate(31 / 12 / Yearcombox.Text)
Yet this does not work because of the data type 'Date' and presents a error which doesn't allow the form to load.
Is there a way to do this?
Upvotes: 1
Views: 328
Reputation: 1148
write This Way To Find Out The Date
you can convert the year to Double.
Follow This Code TOmSolve Your Problem.
Date.FromOADate(30 / 3 / CDbl(Yearcombox.Text))
Upvotes: 2