Solved

vb.net DatePicker default to beginning and end of week

Posted on 2009-05-08
3
456 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
3 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 24339988
0
 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now