Folks,
I have some DateTimePicker controls. When the user selects a date, I would like to show the Week Commencing date, ie - the monday of the week selected.
Any starters ?
Bob
Printable View
Folks,
I have some DateTimePicker controls. When the user selects a date, I would like to show the Week Commencing date, ie - the monday of the week selected.
Any starters ?
Bob
VB Code:
Dim chosenDate As Date = Me.DateTimePicker1.Value Dim newDate As Date Dim dayDifference As Double dayDifference = Double.Parse((chosenDate.DayOfWeek - DayOfWeek.Monday).ToString) newDate = DateAdd(DateInterval.Day, -dayDifference, chosenDate) MessageBox.Show(newDate.ToLongDateString)
Thanks Mendhak, much appreciated.
Also, Any idea how I can set the default DTP display to nothing rather than the current date ?
Bob
YW...Quote:
Originally Posted by staticbob
No clue about the next question though, sorry.
In order to assign a Nothing value to a dtp you need to set the .ShowCheckBox property to True and set the .Checked property to False.
This is the only way to "display" a Null date value.
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DateTimePicker1.ShowCheckBox = True DateTimePicker1.Checked = False End Sub