Results 1 to 3 of 3

Thread: [RESOLVED] datetimepicker doesn't display what I want

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Resolved [RESOLVED] datetimepicker doesn't display what I want

    I have a datetimepicker (DTP). The DTP is bound to a table date field so that the date picker displays the date from the field. Nice, I like that.

    I would like the DTP do one other thing and that is to display nothing if the field that it is bound to is empty. The problem is I am unable to figure out how to set a property for the DTP to display no date.

    I know that a DTP is normally used with a textbox, but if I can just get this thing to work with an empty field I have no need for the textbox. Is there something really obvious in the properties that I am missing? Will the DTP not display nothing?

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,630

    Re: datetimepicker doesn't display what I want


  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Re: datetimepicker doesn't display what I want

    Thanks. It went something like this:

    Code:
            If Not String.IsNullOrWhiteSpace(lblDate.Text) Then
                dtEnd.DataBindings.Add("Text", MasterBase.listTable, "colEndDate", True, DataSourceUpdateMode.OnValidation, DateFormat.ShortDate)
            Else
                dtEnd.Format = DateTimePickerFormat.Custom
                dtEnd.CustomFormat = " "
            End If
    However, there must be at lease one space between the quotes. Without the space you get the default date.

    Thanks a lot!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width