0
Hi James,
Thanks lot..its working fine..and one thing.. i want Default format like this : : in Text Box
How to do in default in textBox : : when i enter First Hour in Textbox...automatically has to move cursor to minute and then seconds..Please how todo.... using windows Application C#.Net
Thank you
0
You can use simple textbox and regular expression to satisfy your need.
Folllowing code will restrict user to enter the data only in hh:mm:ss and
you can specify the range of your textbox while modifying
the regular expression value as per your reqirement.
private void txtTime_Validating(object sender, CancelEventArgs e)
{
System.Text.RegularExpressions.Regex rTime = new System.Text.RegularExpressions.Regex(@"[0-2][0-9]\:[0-6][0-9]\:[0-6][0-9]");
if (txtTime.Text.Length > 0)
{
if (!rTime.IsMatch(txtTime.Text))
{
MessageBox.Show("Please provide the time in hh:mm:ss format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
----------------------------------------------------------------------------------------------------------------------------------------------------
Following code will allow user to enter only digit.
private void txtTime_KeyPress(object sender, KeyPressEventArgs e)
{
if (char.IsDigit(e.KeyChar) || char.IsControl(e.KeyChar)||(e.KeyChar.ToString() == ":"))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
Note: My textbox id is 'txtTime'

0
Hi James,
Thanks for tried...if possible means tell me..otherwise...
I am going to use the Textboxes ..
I have Two textboxes one textbox is Start Default Min Time is 06:00:00 and end time is Max Time is 30:00:00 using C# windows application.....So please tell me how to do...Please give me any other example..now i dont have time also..So please give me example with Validation.....
Thankyou
0
You can use the maxdate property and specify the maxTime you want for your input.
Say if you specify as 10:00:00,in maxdate property it takes the value properly. You cannot specify
maxtime as 30:00:00 as it takes upto 23:59.59. In datetime picker it accept the time as standard time format
which cant go beyond 23:59:59. So I dont think there is any alternate way to specify maximum time as 30:00:00
0
Thanks Lot..thankyou for helpe me..
and One thing..I want to display Time Format Maximum Upto 30:00:00...in Dattime Picker control.. using C# Windows application.so please tell me..How to do...
Thanks
0
ok. Go to the properties of Datetime Picker and set 'Format' property to 'time'and
'ShowUpdown' Property to 'true'
0
I have checked out in this website...dont have Time format...but onlt Date format only have..
So please I want only Time Format (HH:MM:SS) in Date Time Picker control using C#.net Windows Application
Please tell me how to do...
Please reply
Thankyou