473,623 Members | 2,433 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4667
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******** ******@TK2MSFTN GP09.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
SelectedIndexCh anged 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.mach in AT dot.state.fl.us > wrote
in message news:O8******** ******@TK2MSFTN GP11.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******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP09.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 SelectedIndexCh anged 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.mach in AT dot.state.fl.us > wrote in message news:O8******** ******@TK2MSFTN GP11.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******** ******@TK2MSFTN GP09.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
56512
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 this: myCombo.SelectedItem = 3; But after that the ComboBox displays only the first entry of the list. When I add the line
2
4326
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 how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
7
20762
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. The control populates well, both the display values, and selected values. However, when i try to "set" the SelectedValue or SelectedIndex properties, nothing happens.... The default blank value in the ComboBox is always selected. My code is: ...
2
1453
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 properties are set to the names of 2 of the fields in the dataset. I noticed that when the form displays, the combobox defaults to the first item in the list, not to blank (selectedindex=-1) as I would have expected. I can use the...
4
3998
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 - but contain a value. However the value is just for user reference - not really one of the combobox choices. For example intially the combobox should equal the word Select - and the item values can be say 'one', 'two', and 'three'.
2
2220
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 find the item in the list, the visible text changes, but the values of me.Text and Mybase.Text do not change. If you use the mouse and actually click on the item, the values of me.text and Mybase.Text will change. Or, if you use the enter key to...
5
3098
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 the code I check to see if the combobox has any items, if so then I set it to 0 with out issue. Then a bit later in the code I try to set it to the last server used.
5
3186
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 the value and displaymember properties. This works fine. My combobox contains the correct data. However I'm also binding my SelectedValue property to a column in a datatable. Here's where I'm lost. The combobox doesn't show the correct
3
6712
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 bound to. The datatable in the dataset is filled using the typed tableadapter (TableAdapter1). DataTable consists of the typical primary key and value fields. Here is the designer generated code for ComboBox1: this.ComboBox1.DataSource =...
0
8165
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8670
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8469
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4074
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2602
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1778
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.