Results 1 to 7 of 7

Thread: Date Picker add-on

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Date Picker add-on

    I am aware that there is a datetimepicker control. But what I want to do is place a button next to an ordinary textbox and when this button is clicked a date picker appears. The user can select a date which then appears in the textbox. I did some searching but could only find one for ASP. We used to use one of these in Access before they built it into their textbox. Has anyone done this? As I said, I am aware of the datetimepicker control.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Date Picker add-on

    You could use a TextBox, a Button and a MonthCalendar, but I have to wonder why you want to avoid using the control that basically does exactly what you're after.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: Date Picker add-on

    I don't like the way it handles nulls.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Date Picker add-on

    Are you looking to bind data? If so then you can derive your own class from DateTimePicker and add a little bit of code to improve that.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: Date Picker add-on

    You mean where you drag a field from a data source onto the form? No, I'm not doing that.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Date Picker add-on

    Quote Originally Posted by projecttoday View Post
    You mean where you drag a field from a data source onto the form?
    No, that's not what I mean. When you drag an item from the Data Sources window onto a form then the IDE does various things for you and one of those things is configure the binding(s) for the control(s) generated but it's just doing automatically what you can do for yourself in code. Any time you set the DataSource property of a ComboBox or DataGridView, for example, you are binding data. The data doesn't have to come from a database even. In the case of a DateTimePicker, you would bind it something like this:
    vb.net Code:
    1. myDateTimePicker.DataBindings.Add("Value", dataSource, "ColumnOrPropertyName")
    Given that that involves using the DataBindings property, hopefully you would realise that you are indeed binding data if you were doing that, so I'm guessing that you're not.

    Presumably you want to just be able to leave a control blank rather than mess with a check box and formatting to hide an unused value. I'm not aware of a free substitute for the standard DateTimePicker that would allow that but, as I said, you could just use three separate controls, which you could combine into a user control if you wanted to reuse it. If you go that way, just be aware that the MonthCalendar wouldn't float the way the drop-down calendar does for a DateTimePicker, so you'd have to have room in the form to display it.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: Date Picker add-on

    so you'd have to have room in the form to display it.
    or put it on another form.

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