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

  • Home
  • SEARCH
  • 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 6072583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:10:34+00:00 2026-05-23T10:10:34+00:00

Im still learning C# and I have a problem with my SAP add-on Payroll

  • 0

Im still learning C# and I have a problem with my SAP add-on Payroll program.

I have a form where a user selects a starting period. I.e “01 January 2011” through a datetime picker (1) created through visual basic 2010.

I want another datetime picker (2) on the form to automatically show the ending period after exatcly one year. In the case of starting period = “01 January 2011”, I want the ending period to be “31st December 2011”.

My Code:

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
     var endDate = default(DateTime);

     endDate = dateTimePicker1.Value.AddDays(365);

     dateTimePicker2.Value = endDate;
} 

My 2 problems.

  1. The above does not account for leap years. How do I solve this?

  2. With the above code, when 01 January 2011 is selected, the ending date is showing incorrectly, 01 January 2012, however when I input 01 march 2011, the ending date is showing correctly, 29 February 2012. Could this be related to the first problem?

Any help appreciated.

  • 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-23T10:10:34+00:00Added an answer on May 23, 2026 at 10:10 am
    dateTimePicker1.Value.AddYears(1).AddDays(-1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am still learning Jquery and have a problem accessing form elements. My
I am still learning C++ templates, and have encountered a problem regarding calling members
I am new to C# (still learning). My problem statement is that i have
I have a problem with interface lag in C#. Since I'm still learning please
I'm still learning Grails and seem to have hit a stumbling block. Here are
I am still learning socket programming (using Perl) but I have both options (
im currently learning python (in the very begining), so I still have some doubts
Still learning the ropes with Groovy, this problem has tripped me up since last
Hey guys, I'm still learning C and have created a virtual cash register. One
I'm still learning C and I must have misunderstood pointers at some point. I

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.