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]
# 1

Shows us the code you have so far.

spotty at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

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.Click

Me.DateTimePicker1.Visible = True

End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged

DateTimePicker1.Visible = False

End Sub

If 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

DickDonny at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3
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

gpetrosh at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 4

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

DickDonny at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 5
Richard,

Thank you for your help. Your suggestion worked perfectly. I guess I couldn't see the forest despite the trees.

Greg

gpetrosh at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Language...