Solved

set datetimepicker value to first day of the month

Posted on 2004-08-16
3
4,206 Views
Last Modified: 2008-01-09
hi, i have 2 datetimepickers on my form, but i would like the first one's default date to be the first day of the current month.
so in my form_load i tried
DateTimePicker1.Value = (" & Now.Year & " / " & Now.Month & " / 1)
but i get the error
Conversion from 'Double' to 'Date' requires calling the 'Date.FromOADate' method.
and the complete section in brackets is underlined
0
Comment
Question by:jxharding
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Desp
ID: 11808778
string Date1 = DateTime.Today.Month + "/1/" + DateTime.Today.Year;
dateTimePicker1.Value = Convert.ToDateTime(Date1);
0
 
LVL 19

Accepted Solution

by:
Desp earned 500 total points
ID: 11808783
[vb.net]
dim Date1  as string = DateTime.Today.Month + "/1/" + DateTime.Today.Year
dateTimePicker1.Value = Convert.ToDateTime(Date1)
0
 

Author Comment

by:jxharding
ID: 11809318
DateTime.Today.Month & "/1/" & DateTime.Today.Year
thanks desp!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question