473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

combobox problem - two selectedindex properties

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
3 4657
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Steffen Laser | last post by:
Hi group, I have a problem that I already have posted to the german C# newsgroup. Since nobody could help me there, I'd like to try it here again: I set the selected item of a combobox like...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
7
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well....
2
by: chris in grimsby | last post by:
I have a combobox of dropdownlist style as one of the controls on a tabbed form. The list is populated by setting the DataSource property to a dataset and then the DisplayMember and ValueMember...
4
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank...
2
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to...
5
by: john.halet | last post by:
This line of code had been working with out issue, now its throwing errors. In my case I have three items in the ComboBox. If I try to change the selected index it throw the error. Earler in...
5
by: Peter M. | last post by:
I'm struggling with combobox databinding with something I consider a bug... I'm binding my combobox to an array of structs. The struct exposes two public properties, ID and Name, to be used as...
3
by: Magnus | last post by:
Im using a set combobox (ComboBox1) to provide a selection of records from a database table. I have a typed dataset (DataSet1) that contains the typed datatable (DataTable1) that the combobox is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.