Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 9th, 2008, 02:12 AM
Authorized User
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts
Default Dynamically adding year in dropdown

Hi all

I am making an web app. using C#,Sql Server 2005.

I have a dropdown where cuurently one value is there i.e. 2008. After 31st Dec,year 2009 should come dynamically come in the dropdown. How to do this in c#?

Old June 9th, 2008, 07:44 AM
samjudson's Avatar
Friend of Wrox
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts

Something like this will add every year from 2008 to the current year to a combo box

int currentYear = DateTime.Now.Year;

for(int i = 2008; i <= currentYear; i++)
/- Sam Judson : Wrox Technical Editor -/

Similar Threads
Thread Thread Starter Forum Replies Last Post
Events - Adding Dynamically dash dev C# 2005 2 December 5th, 2007 02:05 PM
Adding Controls Dynamically andyj00 C# 0 March 19th, 2007 08:54 AM
dynamically adding objects shawnvb VB How-To 3 February 14th, 2007 03:12 PM
Adding button with dropdown to IE toolbar baburman VB How-To 2 November 9th, 2006 10:10 PM
Modifying table dynamically,storing dropdown value santy_capri Classic ASP Databases 0 July 25th, 2006 06:09 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.