Imports System.Globalization
Dim intloop As Integer
For intloop = 1 To 12
dropdownlist1.Items.Add(New ListItem(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(intloop - 1), intloop))

PS:
- Result = a drop down list of months with 1,2,3...12 as value, and January, February, ..... December as Text
- Remember to import class "System.Globalization"
- A New ListItem has to be declared each time when adding item into a drop down list. The first value is the text of the drop down list item, while the second value is the value of the item.
No comments:
Post a Comment