numericUpDown with time

P

piotrek

Hi. I would like to create numericupdown control that's value is time in
format 12:12.
Is this posible?
Value property contains only decimal.
PK
 
B

Bob Powell [MVP]

You'll need to create a custom control from scratch. The usual time
selection interfaces enable the user to change the hour, minute or second
using some up / down indication. This would be a control for someone of
intermediate control creation skill level.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
P

piotrek

hmm.
Then i designed i class:

public class NumericUpDownEx : NumericUpDown
{
static decimal first = 0;
public NumericUpDownEx()
{
}
protected override void UpdateEditText()
{
if (Value == 59)
{
if (first == 23) first = 0;
else first++;
Value = 0;
}
String fs = first.ToString();
String fsw = Value.ToString();
if (first <= 9)
{
fs = "0" + fs ;
}
if (Value <= 9) fsw = "0" + fsw;
this.Text = fs + ":" + fsw;

}

}



Now i would like user to change values without clicking ( just entering with keyboard ).
Do you know if there is an event when i try to enter data into numericupdown ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top