ComboBox .selectedindex not working?

  • Thread starter Thread starter Mitchell Vincent
  • Start date Start date
M

Mitchell Vincent

Ok, I'm frustrated now. The simplest of things isn't working for me.

I have this in my form's load event (after the combo is populated):

If cmbCategory.SelectedIndex < 0 Then
cmbCategory.SelectedIndex = 0
End If

I want to always have the first thing in the list selected. It selects
it for a split second, then the combo is blanked.

I have the *exact* code in another form in the same project and it works
perfectly.

Heeeeelp!
 
Mitchel,

Know that when you do this the selected index change event (or some equal to
that) is fired.

You are not the first with this problem.

You can greath recursive errors with this kind of code when it is in an
handled event section.

Cor
 
Cor said:
Mitchel,

Know that when you do this the selected index change event (or some equal to
that) is fired.

You are not the first with this problem.

You can greath recursive errors with this kind of code when it is in an
handled event section.

Oh, I bet I know what is going on. I'm databinding the control. Duh.

Thanks Cor, helpful as usual!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top