#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Mumbai
    Posts
    108
    Rep Power
    16

    DtPicker : Can we show blank date and time in DtPicker


    Thanks for great help rpovided by you.


    I am displaying order date and time using DtPicker.

    I want to show spaces / blank as default value of DtPicker

    How shall I do it ?

    With regards
    Vikas Athavale
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    796
    Actually, I am not sure that you can do this. Having something other than a date/time in a datapicker will cause a RTE.
  4. #3
  5. No Profile Picture
    Linux Registered User 28620
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    1
    Rep Power
    0

    Lightbulb


    Hi there,

    I also had the same problem at work but got around it. What you have to do is set the CheckBox property of the DTPicker to TRUE and then when your form loads, you first set the date to whatever you want (most likely today's date) and then you disable it by setting its value to NULL.

    '# First, set date to today... then desables DTPicker #
    DTPicker1.Value = Now
    DTPicker1.Value = Null

    Hope this helps!

    Cheers,

    Gnu Kemist
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Montreal, Canada
    Posts
    486
    Rep Power
    15
    I know this topic is really old. Nearly 1 year old.

    but I was wondering if it was working and if it was possible to do it in Vb.Net

    cause that's what I am doing

    Code:
    Me.DateTimePicker1.Checked = True
            Me.DateTimePicker1.Value = Now
            Me.DateTimePicker1.Value = System.DBNull.Value
    but it's telling me that System.DBNull.Value can't be converted in a Date format.

    cause I really need to have my datapicker to null.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2016
    Posts
    1
    Rep Power
    0
    I used a little trick to manage this feature: use both a textBox and a datePicker

    - The textBox will display the date you select in the datePicker. Can be blank as by default.
    - The datePicker is set to it's minimal width to display only the selection arrow
    - When a date is selected in the datePicker, the value is transfered to the textBox

    Code on the Change event of the datePicker is something like the following:
    Private Sub DTPicker1_Change()
    TextBox1 = Format(DTPicker1.Value, "dd mmm, yyyy")
    End Sub

IMN logo majestic logo threadwatch logo seochat tools logo