?
Solved

Time Display 00:00

Posted on 2007-07-22
3
Medium Priority
?
185 Views
Last Modified: 2010-04-23
Hi Experts

I have a datetime picker which activates on a textbox click event.
How do I get it to display a time of 00:00 when it appears if the textbox is blank or the time as set in the textbox if its not blank. In vb.net.

Regards,
Joe
0
Comment
Question by:JoeBo747
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Priest04 earned 500 total points
ID: 19542421
DateTimePciker.Format = Custom, DateTimePciker.CustomFormat = HH:mm

Place this code in form load event

if textBox1.Text = "" then
    dateTimePicker1.Value = new DateTime(2007,1,1,0,0,0); // we need to pass any year, month and day
else
    dim textBoxDate as DateTime
    if DateTime.TryParse(textBox1.Text, textBoxDate) then
        dateTimePicker1.Value = textBoxDate
    else
        MessageBox.Show("Unrecognized time format!")
    end if
end if

Just for info, value is not just time, but date + time. It only displays time part of the full date.

Goran
0
 
LVL 1

Author Comment

by:JoeBo747
ID: 19542535
Hi Priest04

Thanks again! Just what I needed.

Regards,
Joe


0
 
LVL 18

Expert Comment

by:Priest04
ID: 19542570
You are welcome

Goran
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question