Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6924185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:37:51+00:00 2026-05-27T10:37:51+00:00

I have some funny (?!?) issues with the DateTimePicker and hopefully someone can help

  • 0

I have some funny (?!?) issues with the DateTimePicker and hopefully someone can help me out. I have a form with a DateTimePicker on it and I want to bind it to a property of a custom class. DateTimePicker has a custom format set to dd.MM.yyyy HH:mm:ss. Here is what I have tried and the troubles with those tries:

  • I made a binding to the Value property of DateTimePicker. The property of my custom class contains a valid date. When I run the app I get an ArgumentOutOfRangeException stating that “01.01.0001 00:00:00” is not a valid value for value and it should be between MinDate and MaxDate. (But I can’t set neither DateTime.MaxValue nor DateTime.MinValue to the value property!)
  • I made a binding to the Text property of DateTimePicker. All is running well, but the seconds are always shown as “00”. I can enter different values and they are reflected to the bound property of my custom class!

Any ideas?

Edit
Here is the code snippet out of the designer file:

this.dateTimePickerTimestampFrom.CustomFormat = "dd.MM.yyyy HH:mm:ss";
this.dateTimePickerTimestampFrom.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindingSourceSelectLogEntries, "DateFrom", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.dateTimePickerTimestampFrom.Enabled = false;
this.dateTimePickerTimestampFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePickerTimestampFrom.Location = new System.Drawing.Point(81, 42);
this.dateTimePickerTimestampFrom.Name = "dateTimePickerTimestampFrom";
this.dateTimePickerTimestampFrom.Size = new System.Drawing.Size(147, 20);
this.dateTimePickerTimestampFrom.TabIndex = 3;

Edit 2
The bindingsource is a custom class containing a couple of properties. The values are valid at the moment the binding is set. I set it in the following code:

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);

    // Exception is thrown at the following line.
    // controller is an instance of my custom class containing valid values.
    bindingSourceSelectLogEntries.DataSource = controller; 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:37:51+00:00Added an answer on May 27, 2026 at 10:37 am

    I found out the solution by myself and I would like to tell, so others may not spend so much time on the same problem like I did.

    My design consists of a form and a controller (containing the data to present). In the form I wanted to do everything in the designer to minimize the code behind. So I had a binding source on the form, having an instance of my controller as DataSource. ReflectorPro helped me to find out, that the CurrencyManager was involved because the BindingSource was treated as a list. Therefore all values of all binded controls were set to null prior to get the values from the controller. DateTimePicker doesn’t like null as a value for its Value property and throws the exception.

    Now I did the binding manually in code behind and everything works as I expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some funny deadlock caused by a stupid simple SQL UPDATE query, on
I have some really funky code. As you can see from the code below
I have some classes layed out like this class A { public virtual void
I have some kind of test data and want to create a unit test
I have some funky Firefox issues going on... Here is what my web page
I have some funny noob problem. I try to run unit tests from commandline:
I have developed a JSF application and I am running into some funny behavior
was wondering if you could help me out: I have a method called initializeAll
I have some UI in VB 2005 that looks great in XP Style, but
I have some ASP.NET web services which all share a common helper class they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.