473,507 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change textbox to datetimepicker

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
3 4875
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1228
by: Bhavna | last post by:
I have a datetimepicker (dtp) on my windows form the user initially selects a date and then selects the rooms they wish to book The problem i have is that when the user goes back and tries to...
1
1435
by: CYShao | last post by:
How to change the BGcolor of DateTimePicker ? I fialed to find any attributes of this, but only found BGcolor of calendar. How can I change the BGcolor of DateTimePicker window? Thanks CYShao
2
3848
by: Richard | last post by:
Hi, I have a DateTime picker control on a form. The datetime picker control is data bound to a column in a DataTable. Yes I know about bound DateTime pickers and DBNull and etc. so no troubles...
5
9570
by: christian ternek | last post by:
Hello ! I want to make a custom textbox and inherit a custom control from textbox. Now i want to change the looking of the textbox with the following code: protected override void...
1
9390
by: Rich | last post by:
Hello, I have some datefields in a dataset (ds1). I bind some textbox controls on a windows form to these date fields in ds1, but I only want to see 01/01/2004 instead of 1/1/2004 8:00:00 AM. ...
13
6902
by: Stefan | last post by:
hello, Just a sort of newbie question. How can i change the backcolor of the controls which have the focus (textbox/combobox/datetimepicker) and set it back to white when they lost focus. thanx...
2
1270
by: Art | last post by:
Hi, I'm still somewhat new to OO. I am creating a class for a TextBox because I need some specific things for it to do. That is, I'm inheriting a TextBox and putting in some properties, etc....
0
2186
by: morathm | last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at...
4
2661
by: fts2012 | last post by:
' if the textbox is empty show an error message 1001 Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.