Click here to Skip to main content
15,883,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Windown form,
I choose Date in DateTimePicker,
After that i want to change back to original date used by click Button (RESET).
How to do ?
Please give me advice.

Thanks
I want to learn about Timer,
Where can i learn it ?
Can you give me address ?
I am just beginner only.
Posted
Updated 5-Dec-13 4:39am
v2
Comments
thatraja 5-Dec-13 9:00am    
Include code in your question
BulletVictim 5-Dec-13 9:12am    
A date time picker has the value set to the current date by default when run.
You could just in the button click event set the dateTimePicker.Text = System.DateTime.Now.ToString(), That said it also depends on what value you pass to the DateTimePicker on the form_load(). Then that value you could just use to reset the value on the button click event

Every time you have to revert a step you need to store previous state, in order to restore it.
In this particular case you have to store the previous DateTimePicker.Value property.
 
Share this answer
 
In the button Click code, you can assign the a desired value to the date picker

C#
private void button1_Click(object sender, EventArgs e)

       {        
   dateTimePicker1.Value = DateTime.Now; // customize your time here
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900