473,396 Members | 1,847 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,396 software developers and data experts.

Combo Box Control

So here is my problem, I have a program that i would like to have some
control similar to a combo box. However, I don't want it to be
editable. How can I do this? Also, when my server pass information to
me, i would like to reflect that information in that combo box; in
other words, the information is already in the combo box, i just want
that information showing and highlighted. Is there anyway to do this?

Oct 26 '06 #1
2 1360
You can make the combo read only by setting the dropdown style to
dropdownlist.

To make it show the item you want you need to use the items collection.
ComboBox.ObjectCollection oc = comboBox1.Items;

iterate through the object collection (youll have to cast to the
required type)

foreach (object o in oc)
{
if ((o as string).CompareTo("mystring") == 0)
{
comboBox1.SelectedItem = o;
}
}

and when you find the item you want set this as the selected item

comboBox1.selectedItem = o;

Hope this helps
On Oct 26, 10:56 am, "C#Newbie" <andmenr...@gmail.comwrote:
So here is my problem, I have a program that i would like to have some
control similar to a combo box. However, I don't want it to be
editable. How can I do this? Also, when my server pass information to
me, i would like to reflect that information in that combo box; in
other words, the information is already in the combo box, i just want
that information showing and highlighted. Is there anyway to do this?
Oct 26 '06 #2
seems like it will work, i will check tomorrow since i need to connect
through to the server. Thanks.

Oct 26 '06 #3

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

Similar topics

3
by: Kent Eilers | last post by:
I want to follow naming conventions for my controls - i usually prefix combo boxes with "cbo". When a form is in datasheet view however i do not want the user to see the 'cbo' prefix in front of...
1
by: Edward | last post by:
I have encountered a combo box acting with a mind of its own in a VB.NET Windows app. I have a wizard consisting of a tab control; depending on which page is being displayed the tabs are added...
7
by: Hans Merkl | last post by:
Hi, Can anybody recommend a combo box control (textfield + dropdown list) for ASP.NET? I have looked at some products and it seems they all have some problems. I haven't yet found a combo box...
0
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a...
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
8
by: AA Arens | last post by:
Hi I do have a products table and products-parts table in my Access 2003 database and log all services into a form. I do have at least the following two combo boxes on my form: - Choose...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
13
by: mirandacascade | last post by:
I want to set things up such that a section of code will have been executed by the time one clicks on the drop down arrow on a combo box control. Currently, that section of code resides in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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
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.