Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vb.net DatePicker default to beginning and end of week

Posted on 2009-05-08
3
Medium Priority
?
512 Views
Last Modified: 2012-05-06
I had created a VB.Net windows form.  I would like to use 2 datepicker as a search.  However, I would like the default value from first datepicker to be beginning date of week and datepicker2 to be ending date of week.

So example would be something like:
Monday - Sunday  -->  5/4/2009 - 5/10/2009
Monday - Sunday  -->  5/11/2009 - 5/17/2009
etc.

Can anyone help with this by sending my form_load to have these default date range for the datepicker control?
0
Comment
Question by:holemania
[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
3 Comments
 
LVL 3

Accepted Solution

by:
xbrady earned 2000 total points
ID: 24340050
dateTimePickerFirstDayOfWeek.Value = DateTime.Now.AddDays(-1 * CInt(DateTime.Now.DayOfWeek))
dateTimePickerLastDayOfWeek.Value = DateTime.Now.AddDays(6 - CInt(DateTime.Now.DayOfWeek))
0
 

Author Closing Comment

by:holemania
ID: 31579633
Awesome.  That's what I wanted
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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