set current month in a combo box

sde

Well-known member
Joined
Aug 28, 2003
Messages
160
Location
us.ca.fullerton
i need to make this combobox have the current month selected .. can someone help?

im working with something like this:

Code:
cbMonth.Items.Add(1);
cbMonth.Items.Add(2);
cbMonth.Items.Add(3);
cbMonth.Items.Add(4);
cbMonth.Items.Add(5);
cbMonth.Items.Add(6);
cbMonth.Items.Add(7);
cbMonth.Items.Add(8);
cbMonth.Items.Add(9);
cbMonth.Items.Add(10);
cbMonth.Items.Add(11);
cbMonth.Items.Add(12);

cbMonth.SelectedValue = DateTime.Now.Month;
and this doesnt work.
 
Wow! It took you a whole two minutes. :)

you can also save a bit code by sticking the Add method into a for loop.
 
Back
Top