473,396 Members | 1,938 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 DropDown Style


Combo Box DropDown Style.

A combo box is bound to a data table field name.
When combo box has simple / drop down style then bound is successful.

Other hand if Combo box has drop down list style then bound is
successful but combo box not show data field names.

E.g

1.

cmbName.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList ;
cmbName.DataBindings.Clear();
cmbNameOTR.DataBindings.Add("text", dt, dt.Columns["Name"].Caption);

Here in above code data binding is successful but did not show
anything.
2.

cmbName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown ;
cmbName.DataBindings.Clear();
cmbNameOTR.DataBindings.Add("text", dt, dt.Columns["Name"].Caption);

Here in this example when combo box has Simple or drop down style then
it responses good, with data binding and displaying data as well.

Apr 21 '07 #1
1 13692
Are you sure you want to bind to the column in dt that is reflected by
caption? You should be using "Name" instead as the property to bind to, not
what is returned by the Caption property.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ka************@gmail.comwrote in message
news:11**********************@y5g2000hsa.googlegro ups.com...
>
Combo Box DropDown Style.

A combo box is bound to a data table field name.
When combo box has simple / drop down style then bound is successful.

Other hand if Combo box has drop down list style then bound is
successful but combo box not show data field names.

E.g

1.

cmbName.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList ;
cmbName.DataBindings.Clear();
cmbNameOTR.DataBindings.Add("text", dt, dt.Columns["Name"].Caption);

Here in above code data binding is successful but did not show
anything.
2.

cmbName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown ;
cmbName.DataBindings.Clear();
cmbNameOTR.DataBindings.Add("text", dt, dt.Columns["Name"].Caption);

Here in this example when combo box has Simple or drop down style then
it responses good, with data binding and displaying data as well.

Apr 21 '07 #2

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

Similar topics

6
by: Arlie Rahn | last post by:
Does anyone know of a way (using win32s perhaps) to eliminate that focus rectangle over the selected option you see in a normal VB combo box?
9
by: Bob Alston | last post by:
In 2002, "GrayJay" posted the following code: I did this in a jazz record catalogue to find composers - On a form "frmComposers" Create a text box - txtFindComposer, and add the following sub...
8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
2
by: dancole42 | last post by:
So I have a subform that lists the various items on a particular invoice. First, the user selects a product class from the Class dropdown. This is bound to the Class field in the InvioceLines...
1
by: Vayse | last post by:
I have a databound form, frmClients. One of the field is a combo box, comDepartment, which lets a user select a department for the Client. But I can't figure out how to clear the box. That is,...
4
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
The code below goes into the dropdown event handler for a standard combo box. It makes the dropdown as wide as the widest text entry. Unfortunately, this combo box is on the right edge of the...
1
by: Matsam | last post by:
Hi, In my ASP page, I hv a combo box that contains numerous items. Eventhough I have sorted it in alphabetical order, users find it difficult for selecting an item. ie, if they want to select an...
2
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small...
0
by: JB | last post by:
Hi All, I have a DataGridView with a column showing a combo box containing non binded values (i.e. I set the values in the Combo myself using ComboBoxColumn.Items.Add). I also want this Combo...
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: 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?
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
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...
0
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,...

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.