This ComboBox allows you to show month’s names with the underlying values and the respected index for each month. To get the selected month name use the Text property and to obtain the selected month index use SelectedIndex property. The first item in the array of months is a prompt which might say something like (Select a month) which cannot be selected. If you want to determine if a month was selected use the following.
Code:
If MonthsComboBox2.ValidMonthSelected Then
MsgBox(String.Format("[{0}] [{1}]", MonthsComboBox2.Text, _
MonthsComboBox2.SelectedIndex))
Else
MonthsComboBox2.InvalidMonthSelected()
End If
A call to InvalidMonthSelected displays a message dialog where the text and title can be set via displays a message dialog where the text and title can be set via InvalidMonthMessage for the dialog text and InvalidMonthMessageTitle for the dialog title/text.
Note DataSource, DisplayMember and ValueMember are not displayed in the property window as they have all been set in the control.
Please note that if you do not care for the prompt then it would be a simple change in the underlying code to remove the prompt. I suspect this will not work for everyone as tastes are different and that is the nature of developers. Lastly, the project is VS2008 and should work fine in VS2005 and VS2010.
Last edited by Hack; Dec 9th, 2010 at 11:57 AM.
Reason: Removed EXE From Attachment