Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,924 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,937 people online right now. Registration is fast and FREE... Join Now!




Date Time Picker - How can I choose BOTH a date and a time?

 
Reply to this topicStart new topic

Date Time Picker - How can I choose BOTH a date and a time?, Date Time Picker - getting both a date and a time.

shirotaka
13 Dec, 2007 - 10:33 PM
Post #1

New D.I.C Head
*

Joined: 13 Dec, 2007
Posts: 2


My Contributions
Hello All,

I'm fairly new to VB.NET, and I'm trying to use the Date Time Picker control.
I'd like to be able to select both a date and time.
When I click the selector arrow, and the calendar comes up, there seems to be no mechanism to also select a time.

Any ideas?

Thanks

Kent
User is offlineProfile CardPM
+Quote Post

RodgerB
RE: Date Time Picker - How Can I Choose BOTH A Date And A Time?
13 Dec, 2007 - 11:10 PM
Post #2

D.I.C Lover
Group Icon

Joined: 21 Sep, 2007
Posts: 2,166



Thanked: 17 times
Dream Kudos: 2200
Expert In: Dot Net Technologies

My Contributions
Yes, when I first used this control I didn't think it made much sense to call it DateTime picker without the ability to select a time.

Try using a TextBox, then convert the value into a DateTime instance if need be, thats how I'd do it anyway.

CODE

Dim dteTime As Date = Convert.ToDateTime(TextBox1.Text)


Replace TextBox1 with the textbox you'd like to use obviously. smile.gif
User is offlineProfile CardPM
+Quote Post

Nayana
RE: Date Time Picker - How Can I Choose BOTH A Date And A Time?
13 Dec, 2007 - 11:41 PM
Post #3

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
The dateTimePicker can indeed do time. Hence the name smile.gif

Just change the Format property to time, and the ShowUpDown to True.

Either in the editor, or in code like

CODE

dateTimePicker1.Format = Time
dateTimePicker1.ShowUpDown = True


alien.gif
User is offlineProfile CardPM
+Quote Post

RodgerB
RE: Date Time Picker - How Can I Choose BOTH A Date And A Time?
14 Dec, 2007 - 02:50 AM
Post #4

D.I.C Lover
Group Icon

Joined: 21 Sep, 2007
Posts: 2,166



Thanked: 17 times
Dream Kudos: 2200
Expert In: Dot Net Technologies

My Contributions
Thanks for that Nayana! That explains it...

CODE
intIntelligence += 1


alien.gif
User is offlineProfile CardPM
+Quote Post

shirotaka
RE: Date Time Picker - How Can I Choose BOTH A Date And A Time?
14 Dec, 2007 - 08:35 AM
Post #5

New D.I.C Head
*

Joined: 13 Dec, 2007
Posts: 2


My Contributions
Thanks for the info.

I suppose the DateTimePicker is a Date OR Time picker, but not both.

Kent
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 02:53PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month