Question on Windows Application ComboBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

How do I programmatically set the default selected value of a ComboBox?

I have a ComboBox "CmbYear" that has the years and I'd like to set it's
default selected value to the current year like so:

CmbYear.SelectedValue = DateTime.Now.Year.ToString();

But it doesn't work and the application doesn't load with any selected value
for CmbYear.

Why's that?


ywb.
 
WB,

The SelectedIndex the most easiest one, if you want to find that than you
can use the FindStringExact before that.

I hope this helps,

Cor
 
That worked, thanks!



Cor Ligthert said:
WB,

The SelectedIndex the most easiest one, if you want to find that than you
can use the FindStringExact before that.

I hope this helps,

Cor
 
Back
Top