PC Review


Reply
Thread Tools Rate Thread

change textbox to datetimepicker

 
 
Darin
Guest
Posts: n/a
 
      11th Dec 2003
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!
 
Reply With Quote
 
 
 
 
solex
Guest
Posts: n/a
 
      11th Dec 2003
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:%23chmPg$(E-Mail Removed)...
> 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!



 
Reply With Quote
 
Darin
Guest
Posts: n/a
 
      11th Dec 2003
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!
 
Reply With Quote
 
solex
Guest
Posts: n/a
 
      11th Dec 2003
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:(E-Mail Removed)...
> 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!



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DateTimePicker not updating in DB unless I change the date Tony K Microsoft VB .NET 4 22nd Oct 2007 11:25 PM
TextBox, DateTimePicker and OO =?Utf-8?B?QXJ0?= Microsoft VB .NET 2 14th Jan 2005 01:49 PM
datetimepicker date change override =?Utf-8?B?Qmhhdm5h?= Microsoft Dot NET 0 21st Feb 2004 03:21 PM
How to change the BGcolor of DateTimePicker ? CYShao Microsoft C# .NET 1 8th Oct 2003 10:01 AM
Is there a simple way to change the DateTimePicker style. It looks sloppy. Sam Microsoft Dot NET Framework Forms 0 19th Aug 2003 09:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:09 AM.