473,657 Members | 2,535 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 13264
Dom
Check your code. Somewhere, you must have "Combobox1.Sele ctedIndex =
-1". There is really no other way for this to happen.

One way to check is to capture the event "SelectedIndexC hanged" 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.mic rosoft.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 selenctedindexc hanged.
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.mic rosoft.comwrote in message
news:04******** *************** ***********@mic rosoft.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 SelectedItemCha nged 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
10252
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 "descr", and datasource to the array of MyObjects. How can i set the selected value of that combobox based on the ValueMember OR how can i find the index of an item in the combobox BY ValueMember?
4
3999
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'.
4
6683
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 value as a varible. I am using the code below but it isn't working any ideas am I using the right method. combobox1.selecteditem = getcolvalue(0) Any help appreciated.
1
1682
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 Page.IsPostBack Then .. ..
3
6291
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 property). In my code I cause a number of these to be selected - but if the first selected item is not within the currently visible range then there is no change to the display. This gives the impression that nothing has happened. I think...
6
5187
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 Class
2
2663
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 highlighted?
2
3679
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 different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc.. then,i have a datagrid...
1
5223
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 datasource. When the user selects an item in the combobox,and enters the item(text) in the 2 text box , I want all the 3(combobox selected item, and the entered text in the 2 textbox) of them to store it a a table name called...
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8726
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7320
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
5632
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
4151
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...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.