Solved

vb.net DatePicker default to beginning and end of week

Posted on 2009-05-08
3
493 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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