By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

combobox problem - two selectedindex properties

P: n/a
Hi all,
I am using the standard System.Windows.Forms.ComboBox controls on a form.
There are 5 or 6 comboboxes and their selection depends on each other. The
comboboxes behave strangely probably because there are two properties called
SelectedIndex and selectedIndex. Both usually have different values. Has
anyone experienced any problems using comboboxes?

Thanks.
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

AFAIK there is one SelectedIndex which return the index of the item selected
and SelectedItem that return the item itself

How are the controls behaving?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nikhil Patel" <ni********@aol.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
Hi all,
I am using the standard System.Windows.Forms.ComboBox controls on a form. There are 5 or 6 comboboxes and their selection depends on each other. The
comboboxes behave strangely probably because there are two properties called SelectedIndex and selectedIndex. Both usually have different values. Has
anyone experienced any problems using comboboxes?

Thanks.

Nov 16 '05 #2

P: n/a
Hi,
It is hard to explain all the problems. But for example, when I want to
clear the selection, I try to set the SelectedIndex property to -1. But it
stays at 0. I also tried to set it to -1 twice. But it does not change
to -1. In the locals window each combobox shows two properties -
SelectedIndex and selectedIndex and these property almost always have
different values. I just need to be able to clear the selection and fire the
SelectedIndexChanged event upon clearing the selection. Now I have managed
to successfully clearing the selection by seting null to SelectedItem
instead of seting SelectedIndex to -1. But when the DropDownStyle is
DropDownList, it throws an exception.

Thanks.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:O8**************@TK2MSFTNGP11.phx.gbl...
Hi,

AFAIK there is one SelectedIndex which return the index of the item selected and SelectedItem that return the item itself

How are the controls behaving?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nikhil Patel" <ni********@aol.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
Hi all,
I am using the standard System.Windows.Forms.ComboBox controls on a

form.
There are 5 or 6 comboboxes and their selection depends on each other. The comboboxes behave strangely probably because there are two properties

called
SelectedIndex and selectedIndex. Both usually have different values. Has
anyone experienced any problems using comboboxes?

Thanks.


Nov 16 '05 #3

P: n/a
Hi,

Can you post some code?
I find very weird what you describe, You may see two SelectedIndex if you
use the watch windows, one may be the property, other may be the internal
variable, or maybe the inherited value. but anyway they all must have the
SAME value.
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Nikhil Patel" <ni********@aol.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,
It is hard to explain all the problems. But for example, when I want to clear the selection, I try to set the SelectedIndex property to -1. But it
stays at 0. I also tried to set it to -1 twice. But it does not change
to -1. In the locals window each combobox shows two properties -
SelectedIndex and selectedIndex and these property almost always have
different values. I just need to be able to clear the selection and fire the SelectedIndexChanged event upon clearing the selection. Now I have managed
to successfully clearing the selection by seting null to SelectedItem
instead of seting SelectedIndex to -1. But when the DropDownStyle is
DropDownList, it throws an exception.

Thanks.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:O8**************@TK2MSFTNGP11.phx.gbl...
Hi,

AFAIK there is one SelectedIndex which return the index of the item

selected
and SelectedItem that return the item itself

How are the controls behaving?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Nikhil Patel" <ni********@aol.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
Hi all,
I am using the standard System.Windows.Forms.ComboBox controls on a

form.
There are 5 or 6 comboboxes and their selection depends on each other. The comboboxes behave strangely probably because there are two properties

called
SelectedIndex and selectedIndex. Both usually have different values. Has anyone experienced any problems using comboboxes?

Thanks.



Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.