|
-
Feb 15th, 2018, 03:18 AM
#1
Thread Starter
Fanatic Member
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.
-
Feb 15th, 2018, 05:03 AM
#2
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.
-
Feb 15th, 2018, 09:22 AM
#3
Thread Starter
Fanatic Member
Re: Date Picker add-on
I don't like the way it handles nulls.
-
Feb 15th, 2018, 05:36 PM
#4
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.
-
Feb 15th, 2018, 08:51 PM
#5
Thread Starter
Fanatic Member
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.
-
Feb 15th, 2018, 09:35 PM
#6
Re: Date Picker add-on
 Originally Posted by projecttoday
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:
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.
-
Feb 15th, 2018, 10:51 PM
#7
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|