• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

Error by Day(Now) in a Windows application

In a web application I can use Year(Now), Month(Now), and Day(Now) just as I would expect.

In a Windows application I can use Year(Now) and Month(Now) but NOT Day(Now) and this is certainly not what I would expect. When I use it, I get the error:

Error      1      'Day' is a type and cannot be used as an expression.      C:\1. Applications NZ-QM\Windows\SAP Recurring Tool Aid\SAP Recurring Tool Aid\Form1.vb      43      16      SAP Recurring Tool Aid

Can you tell me:

1/ Why can I not use Day(Now)?

2/ How can I then find the day number in a month?
0
neesgaard
Asked:
neesgaard
2 Solutions
 
CluskittCommented:
Add this to your form:
Imports Microsoft.VisualBasic.DateAndTime
0
 
CodeCruiserCommented:
Or use

Now.Today.Day
0
 
neesgaardAuthor Commented:
I tried to split points but did not succeed - sorry for this.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Éric MoreauSenior .Net ConsultantCommented:
for your second question, you can use DaysInMonth as shown in http://msdn.microsoft.com/en-us/library/system.datetime.daysinmonth.aspx
0
 
neesgaardAuthor Commented:
1/ First suggestion works fine!

2/ Second suggestion should be Date.Today.Day.
0
 
CluskittCommented:
You can request attention and ask for the points to be reassigned, or for the question to be open and then select multiple answers.
0
 
neesgaardAuthor Commented:
Is there a waiting time for the question to be opened?
0
 
CluskittCommented:
You have to wait till a moderator sees it, but you'll be notified when it is.
0
 
neesgaardAuthor Commented:
Thank you!
0
 
neesgaardAuthor Commented:
Split is now completed!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now