We all know that 2038 is going to be a big year. In a mere 14 years, a bunch of devices are going to have problems.

Less known is the Y2030 problem, which is what Ventsislav fighting to protect us from.

for (int year = 2000; year <= 2030; year++)

string strCurrentYear = DateTime.Now.Year.ToString();
for (int i = 0; i < DYearDropDownList.Items.Count; i++)
    if (DYearDropDownList.Items[i].Text == strCurrentYear)
        DYearDropDownList.SelectedIndex = i;
        WYearDropDownList.SelectedIndex = i;
        MYearDropDownList.SelectedIndex = i;

Okay, likely less critical than Y2038, but this code, as you might guess, started its life in the year 2000. Clearly, no one thought it'd still be in use this far out, yet… it is.

It's also worth noting that the drop down list object in .NET has a SelectedValue property, so the //SELECT THE CURRENT YEAR section is unnecessary, and could be replaced by a one-liner.

With six years to go, do you think this application is going to be replaced, or is the year for loop just going to change to year <= 2031 and be a manual change for the rest of the application's lifetime?

I mean, they could also change it so it always goes to currentYear or currentYear + 1 or whatever, but do we really think that's a viable option?

[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.