TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sonali Chaudhari
NA
6
623
Incrementing Years in Combobox
Aug 9 2018 5:19 AM
Hello!
I am a beginner in C# and was trying to make a birthdate boxes using combobox.
This is the code where i am facing prob for Year part. I am getting the values in the combobox in 3k &4k.
private void SignUpPage_Load(object sender, EventArgs e)
{
comboBox1.Items.Add("January");
comboBox1.Items.Add("February");
comboBox1.Items.Add("March");
comboBox1.Items.Add("April");
comboBox1.Items.Add("May");
comboBox1.Items.Add("June");
comboBox1.Items.Add("July");
comboBox1.Items.Add("August");
comboBox1.Items.Add("September");
comboBox1.Items.Add("October");
comboBox1.Items.Add("November");
comboBox1.Items.Add("December");
comboBox1.SelectedIndex = comboBox1.FindStringExact("January");
comboBox3.Text = DateTime.Today.Year.ToString();
for (int i = 1950; i <= 2018; i++)
{
comboBox3.Items.Add(DateTime.Today.Year + (i)).ToString();
}
Kindly suggest or share the code for the same.
Thanks :)
Reply
Answers (
3
)
How to do both simultaneously?
Unable to upload file to store in SQL using C# MVC