473,503 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combobox not display selected item

I am writing a Windows Form app in c# and I've populated a combobox with
values.

I click on the down arrow to display the list and the list of values
displays correctly. Once I select a value, the list disappears and the
selected value does NOT display as the selected item. If I click the down
arrow again and re-select the value, this time it displays.

What's wrong?

Thanks,
Mark
Dec 21 '07 #1
3 13202
Dom
Check your code. Somewhere, you must have "Combobox1.SelectedIndex =
-1". There is really no other way for this to happen.

One way to check is to capture the event "SelectedIndexChanged" and
then set a break point there to see how the event is being fired.

Dom


On Dec 21, 12:38*pm, Mark Boettcher
<MarkBoettc...@discussions.microsoft.comwrote:
I am writing a Windows Form app in c# and I've populated a combobox with
values.

I click on the down arrow to display the list and the list of values
displays correctly. Once I select a value, the list disappears and the
selected value does NOT display as the selected item. If I click the down
arrow again and re-select the value, this time it displays.

What's wrong?

Thanks,
Mark
Dec 21 '07 #2
Hi,

Check your code, see what methods are handling the selenctedindexchanged.
Also verify what you do ni that method, if you affect other controls's
status it's possible that the handlers of those other controls do the same
with the combo.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Mark Boettcher" <Ma***********@discussions.microsoft.comwrote in message
news:04**********************************@microsof t.com...
>I am writing a Windows Form app in c# and I've populated a combobox with
values.

I click on the down arrow to display the list and the list of values
displays correctly. Once I select a value, the list disappears and the
selected value does NOT display as the selected item. If I click the down
arrow again and re-select the value, this time it displays.

What's wrong?

Thanks,
Mark

Dec 21 '07 #3
I found my problem - in the course of executing the SelectedItemChanged event
I was clearing the combobox value list with .Items.Clear.

Txs,
Mark
Dec 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10240
by: farseer | last post by:
Hi, I have a combobox who's data source i set to an array of objects (call it MyObject). these objects have get properties: key, value, descr. i set ValueMember to "key", DisplayMember to...
4
3973
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...
4
6654
by: Michael Turner | last post by:
Hi I am having a problem with a combobox the values are generated from a recordset, I need to beable to change the selected item to the value specified in a configuration file, I have stored the...
1
1669
by: Justin | last post by:
Hi all, I have a bunch of drop-down lists that should each display an item (from a SQL Server lookup table) based on another piece of data from a separate table. For example; If Not...
3
6282
by: peter.mosley | last post by:
I've tried googling for the answer to this problem, without any luck. I'm sure the truth must be out there somewhere! I have a multiselect listbox populated with many items (set by the RowSource...
6
5166
by: Smokey Grindle | last post by:
Say I have a combo box with the following simple object Public class MyObject public ID as integer public Name as string public overrides sub ToString() as string return name end sub end...
2
2656
by: Academia | last post by:
I have a combobox that when it drops down the selected item is not highlighted. I'm guessing there is a property that controls this but can't find one. Is there? Should it always be...
2
3666
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
1
5215
by: sbandalli | last post by:
Hello, I have a Datagridview which has a combobox,and 2 textbox, The combobox is bound to a Datasource(Database Sql Server and the table name is Category) ,and Datagridview is not bounded to any...
0
7202
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
7084
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...
0
7278
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,...
0
7328
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...
0
7458
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...
0
4672
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...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
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...

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.