Bound combo box problem

J

J L

I hope this does not post twice. I got an error on the first attempt.

I have a combo box on a form with DropDownStyle = DropDownList

I have bound it as follows:

cmboOp.DataSource = opTable
cmboOp.DisplayMember = "OperatorName"
cmboOp.ValueMember = "OperatorID

The binding works fine. I put a test button on the form that does the
following:

cmboOp.SelectedIndex = -1

The first time I click the button, the combo box displays the first
item in the list. The second time it is blank.

I had expected it to be blank on the first time. So what is going on
or what have I done wrong?

TIA,
John
 
C

Cor Ligthert

JL,

I thought that this has been in past often in the newsgroup. Can you try to
set it twice to "-1", there was a bug which had this behaviour, however I
don't know if it is fixed with sp1 and/or that it is exactly your problem.

I hope this helps,

Cor
 
H

Herfried K. Wagner [MVP]

J L said:
I have a combo box on a form with DropDownStyle = DropDownList

I have bound it as follows:

cmboOp.DataSource = opTable
cmboOp.DisplayMember = "OperatorName"
cmboOp.ValueMember = "OperatorID

The binding works fine. I put a test button on the form that does the
following:

cmboOp.SelectedIndex = -1

The first time I click the button, the combo box displays the first
item in the list. The second time it is blank.

BUG: ComboBox Does Not Clear When You Set SelectedIndex to -1
<URL:http://support.microsoft.com/?scid=kb;EN-US;327244>

Try setting 'SelectedIndex' twice.
 
J

J L

Thanks Cor and Herfried,
I thought I had tried setting it twice but I guess not because that
works fine. Also, I did try a google search before trougling the group
with an old question but could not find the link you supplied. So once
again, thank you to the Gurus!!

John
 

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

Top