Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

set datetimepicker value to first day of the month

Posted on 2004-08-16
3
Medium Priority
?
4,285 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:Fahad Mukhtar
ID: 11808778
string Date1 = DateTime.Today.Month + "/1/" + DateTime.Today.Year;
dateTimePicker1.Value = Convert.ToDateTime(Date1);
0
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 2000 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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
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)…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

722 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