-
Dec 18th, 2008, 12:50 PM
#1
Thread Starter
Member
How to clear dateTimePicker in vb.net.....
Hi dudes...
I want to build a query such that if no date is selected in datetimepicker all records must be displayed, if user select date then record with that date must be displayed.
-
Dec 18th, 2008, 12:56 PM
#2
Addicted Member
Re: How to clear dateTimePicker in vb.net.....
dateTimePicker doesn't have a null or nothing value.
-
Dec 18th, 2008, 01:00 PM
#3
Re: How to clear dateTimePicker in vb.net.....
Look at the check property of the the datetime picker. If check you use the date selected if not you ignore it
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Dec 18th, 2008, 01:07 PM
#4
Addicted Member
Re: How to clear dateTimePicker in vb.net.....
Originally Posted by GaryMazzone
Look at the check property of the the datetime picker. If check you use the date selected if not you ignore it
I just dropped a datetimePicker on a form.. and by default the checked property already says true even if the user has not selected anything yet.
I'm in 2005, not sure about OP, or replies.
-
Dec 18th, 2008, 01:10 PM
#5
Re: How to clear dateTimePicker in vb.net.....
So what I did was place it on the form. On the form load event I set it to Unchecked. When a user selects a date in the control it gets checked automaticaly.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Dec 18th, 2008, 01:15 PM
#6
Re: How to clear dateTimePicker in vb.net.....
Originally Posted by MaslowB
I just dropped a datetimePicker on a form.. and by default the checked property already says true even if the user has not selected anything yet.
I'm in 2005, not sure about OP, or replies.
Change the "ShowCheckbox" property to true to actually see the checkbox, then toggling the "checked' property will actually disable the control when its unchecked...
-
Dec 18th, 2008, 01:22 PM
#7
Addicted Member
Re: How to clear dateTimePicker in vb.net.....
Originally Posted by kleinma
Change the "ShowCheckbox" property to true to actually see the checkbox, then toggling the "checked' property will actually disable the control when its unchecked...
Boy is that handy, never noticed it. Thanks.
-
Dec 18th, 2008, 01:32 PM
#8
Thread Starter
Member
Re: How to clear dateTimePicker in vb.net.....
Originally Posted by kleinma
Change the "ShowCheckbox" property to true to actually see the checkbox, then toggling the "checked' property will actually disable the control when its unchecked...
Thnks dude,,,,,,it worked..........
-
Dec 18th, 2008, 01:34 PM
#9
Re: How to clear dateTimePicker in vb.net.....
It isn't ideal.. A nullable datetimepicker would be very nice to have, but until we see that (which is likely never) we use the checkbox approach..
-
Oct 23rd, 2013, 12:02 PM
#10
New Member
Re: How to clear dateTimePicker in vb.net.....
It’s late, but here is the answer (I am using 2010, vb.net)
1. Set DateTimePicker Format property to custom
2. Place combobox over the DateTimePicker
3. In the code:
Private Sub cmbBlankDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbBlankDate.Click
cmbFromBlankDate.Visible = False
FromDateTimePicker.Visible = True
End Sub
Private Sub DateTimePicker_MouseCaptureChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker.MouseCaptureChanged
cmbFromBlankDate.Visible = True
FromDateTimePicker.Visible = False
End Sub
-
Oct 23rd, 2013, 12:24 PM
#11
Re: How to clear dateTimePicker in vb.net.....
Do you think is late? only 5 years late. LOL. But I appreciate your hack. (not really for it but some may)
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|