datetimepicker control
Here is my dillema,
I am trying to create a function with a button to open a hidden datetimepicker, once the date has been selected then hide it again. I have no problem opening the picker from the button, but once date has been selected the textbox still appears. I have tried numerous ideas and think it is time to ask the panel to see if anyone has tried to do this before or knows the commands to do this.
Thanks for your time
Greg
[441 byte] By [
gpetrosh] at [2007-12-29]
Hi Greg
It's a little hard to completely grasp what you are trying to do, so apologies if the enclosed proves irrelevant.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickMe.DateTimePicker1.Visible = TrueEnd SubPrivate Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChangedDateTimePicker1.Visible =
FalseEnd SubIf this snippet of code does not help, please let me know and give a little more information on what you are trying to achieve
Richard
Richard,
What I am trying to do is click a button to make the control visible, then select a date, and once the date has been selected, hide the datetimepicker. Its just to keep the form a little cleaner.
Thanks
Ok .. well the code I posted earlier should handle that.
In short ...
On the click event of the button, set the date picker's visible property to True. On the date pickers value changed event, hide the date picker control using whatever logic is necessary to determine if the selected date is valid.
Give me a shout if any of that is unclear
Richard