?
Solved

DateTimePicker reset min max Date

Posted on 2011-05-10
2
Medium Priority
?
1,971 Views
Last Modified: 2012-06-27
Hello EE,

in my code, i change the MinDAte and maxDate of the datetimepicker...
but i would like to be able to put it back on "Default values" also.

I know i could type like  .mindate = '1800-01-01' or something like that but is there an event or method i can call that it refreshes the control to default values like if I had just create it?

A kind of:  dtpPicker.Refresh()  dtpPicket.ResetValues   you know
0
Comment
Question by:PhilippeRenaud
2 Comments
 
LVL 2

Accepted Solution

by:
ExpertHelp79 earned 2000 total points
ID: 35734989
to refresh

dateTimePicker1.Value = System.DateTime.Now;


===========================================================

picker.Value = picker.Value.Date;
EDIT: To specify a particular time, you'd use something like:
TimeSpan time = new TimeSpan(3, 30, 0); // 3 hours and 30 minutespicker.Value = picker.Value.Date + time;

==================================================================
'Created a global string variable with initial value
     Dim gstrStartDate As String = "20/01/1988"    '(Australian Date Format)

Private Sub btnReset_Click
'Set Start Date to 20/01/1988
        gstrStartDate = "20/01/1988"
        dtpStartDate.Value = Convert.ToDateTime(gstrStartDate)
End Sub
0
 
LVL 1

Author Closing Comment

by:PhilippeRenaud
ID: 35734997
thks
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 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