combobox.SelectedIndex = -1 problem

D

Dave

I am trying to simply display/select information from a
combo box filled with table information. This presents
no problem until I have a null field. I check for Null
values in input table/columns and if present I do not
want to have combo box display anything. I have tried:
combobox.SelectedIndex = -1 but the Selected Index does
not change to -1. The combo box is bound to nothing;
DataSource/DisplayMember property = dataset that filled
combo box; ValueMember = control column in dataset that
filled combo box. I'm sure this is a rookie kind of
problem ... but would appreicate some advice ... thanks!
Dave
 
J

John

I too have the same problem. I have read the microsoft article and still
does not fix the problem. I tried to first two resolutions but not the
third because I want to databind. Is there another way around this isssue?

Thanks
 
G

Guest

Omkumar,
Thanks for pointing me to the knowledge base article ..
problem is the work arounds don't work in my
application. At least I can quit pulling my hair out ...
and see if microsoft has a resolution to this bug ... I'm
running .Net Framework 1.1 ... article refers to 1.0 ...
which you would think would be better not worse.
Thanks again.
Dave
 
O

Omkumar Enkannathan

I am running 1.1 and i did have that problem. but setting the selectedindex
to -1 twice, solved the problem for me. however my code looks ugly :(
 
H

Herfried K. Wagner [MVP]

* "Dave said:
I am trying to simply display/select information from a
combo box filled with table information. This presents
no problem until I have a null field. I check for Null
values in input table/columns and if present I do not
want to have combo box display anything. I have tried:
combobox.SelectedIndex = -1 but the Selected Index does
not change to -1. The combo box is bound to nothing;
DataSource/DisplayMember property = dataset that filled
combo box; ValueMember = control column in dataset that
filled combo box.

This is a bug, see:

<http://support.microsoft.com/default.aspx?scid=kb;en-us;327244>
 

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