Combobox/ trying to populate current year plus the next 10 years.
I'm trying to use a combobox to pull the current year and then populate the next ten years. I don't want to manually put in the years in the 'item collections'. I would rather it update automatically based on the system year. How should I go about doing this?
My first instinct is to set the combobox item to the current year based on the system date, then create a loop that increments based on on counter up to current year + 10. I'm assuming this would be done on the 'form_load' event handler???
Re: Combobox/ trying to populate current year plus the next 10 years.
vb Code:
ComboBox1.Text = Date.Now.Year
For i As Integer = 0 To 9
ComboBox1.Items.Add(Date.Now.Year + i)
Next
Yah, you could put that one in the form_load event. Or if you have a sub which loads your forms data, you could put it in there.