Error using DateAndTime struct in VB Statements
I have the following code:
'DateAndTime' is not declared. It may be inaccessible due to its protection level.
'DateInterval' is not declared. It may be inaccessible due to its protection level.
These objects are under the Microsoft.VisualBasic namespace, I assumed it would be imported by default. If thats not the case then what do I need to do to import the namespace (aside from creating a class with functions)?
Dim targetDate As Date = New Date(2015, 1, 14) Dim result as Long = DateAndTime.DateDiff(DateInterval.Day, Date.Now, targetDate) result.Dump()When I try to run it I get this:
'DateAndTime' is not declared. It may be inaccessible due to its protection level.
'DateInterval' is not declared. It may be inaccessible due to its protection level.
These objects are under the Microsoft.VisualBasic namespace, I assumed it would be imported by default. If thats not the case then what do I need to do to import the namespace (aside from creating a class with functions)?
Comments
Then, type Microsoft.VisualBasic into Additional Namespace Imports.
Then click Set as Default for New Queries.