tags:

views:

63

answers:

3

Hi all,

Is there a winforms month-only picker control? I need to allow the user to select the month regardless of the day of the month.

Thanks.

+1  A: 

There isn't such standard control but I it easy to make it on you own , add all months to Drop Down control.

Jacob
A: 

I don't know of any such control. You could add the months to a Listbox or Combobox and have them that way?

Tony
A: 

Just for fun, a month-names ComboBox in three lines:

comboBox1.DataSource = new BindingSource(
    System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthNames
        .Where(m => m != String.Empty)
        .Select((m, i) => new { Name = m, Index = i })
        .ToDictionary(x => x.Index, x => x.Name),
    null);
comboBox1.DisplayMember = "Value";
comboBox1.ValueMember = "Key";

Now comboBox1.SelectedValue will be 0..11 depdending on the month selected.

Matt Hamilton
Thanks all for your replies.Well, the fun part is that the month should be selected along with the year.Like: september 2007 or january 2010, etc.Sorry for not being very clear on that.Of course, a listbox or combobox can also be adapted for my needs, but I would imagine the control being more like the DateTimePicker, that is, more user-friendly.
Adi