1

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?

1
  • 2
    FromOADate requires a double type as per MSDN Commented Jan 30, 2014 at 10:10

1 Answer 1

2

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))

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I was not aware of this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.