By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,633 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,633 IT Pros & Developers. It's quick & easy.

change textbox to datetimepicker

P: n/a
Is there a way to, at runtime, change a textbox to be a datetimepicker?

I have a form that I allow the user to specify what field types the
input boxes are. They can be regular text, integer, money, date, or
date&time. So, I have the textbox and when I see that this field is a
date, I want to change the textbox to a datetimepicker. Can that be done
at runtime?

TIA

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Darin,

Just hide the textbox and show the DateTimePicker in its place when the user
makes a request to enter a date.

Dan

"Darin" <darin_nospam@nospamever> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Is there a way to, at runtime, change a textbox to be a datetimepicker?

I have a form that I allow the user to specify what field types the
input boxes are. They can be regular text, integer, money, date, or
date&time. So, I have the textbox and when I see that this field is a
date, I want to change the textbox to a datetimepicker. Can that be done
at runtime?

TIA

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2

P: n/a
I have done that before, I just don't want to now. This for has 10
textboxes, user definable to text, int, money, date, date&time. I have
my own controls for int text box and money text box, so, using your
solution, I would have to create 10 text boxes, 10 integer boxes, 10
money boxes, and 10 datetimepicker, then hide the one I don't need. That
seems like an awful lot of overhead.

I guess I could build each box at runtime for that specific type - I
will work on that.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3

P: n/a
Darin,

you could always instantiate the control when you need it and then dispose
of it when you don't

Dim dtctl as New DateTimePicker

MyForm.Controls.Add(dtctl)

' and when the user requests a new type of control

MyForm.Controls.Remove(dtctl)
dtctl = Nothing

' now show the new control
"Darin" <darin_nospam@nospamever> wrote in message
news:u9**************@TK2MSFTNGP10.phx.gbl...
I have done that before, I just don't want to now. This for has 10
textboxes, user definable to text, int, money, date, date&time. I have
my own controls for int text box and money text box, so, using your
solution, I would have to create 10 text boxes, 10 integer boxes, 10
money boxes, and 10 datetimepicker, then hide the one I don't need. That
seems like an awful lot of overhead.

I guess I could build each box at runtime for that specific type - I
will work on that.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.