0
I have to create a Combobox only with the months of the year to handle the system’s paying bills. So far so good, the problem is that the client wanted to be selected the current month in Load.
I want to bring the data dynamically, without using an ENUM with the handwritten values.
How is the code:
private void LoadComboBoxMonths()
{
string[] arrayMonths = DateTimeFormatInfo.CurrentInfo.GetMonthName;
forech(var item in arrayMonths)
{
Months.Add(item.ToUpper());
}
cboMesCorrente.DataSource = Monhts
cboMesCorrente.SelectedItem = DateTime.Now.Month.ToString("MMMM");
}
That one Selecteitem above does not work.