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

Limiting a Bound ComboBox List Items

I have databound a Windows form ComboBox control to a DataSource and
DataMember and it is properly showing the data as I navigate through
the records. My question concerns the choices in the pull-down list
itself.

The Field is Priority and the only available choices should be "High",
"Low", "Do Not Call".

These are the only choices I would like to see in drop-down, but
because it is bound to the column it is showing multiple instances of
each (based on the column it is tied to).

Question: How can data bind a combobox to a datacolumn, but still
retain control of what choices are available from the drop-down list.
(only one of each)

Thanks,

Apr 17 '07 #1
2 1804
You can ensure that there are no duplicates in the data source.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

<gl******@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>I have databound a Windows form ComboBox control to a DataSource and
DataMember and it is properly showing the data as I navigate through
the records. My question concerns the choices in the pull-down list
itself.

The Field is Priority and the only available choices should be "High",
"Low", "Do Not Call".

These are the only choices I would like to see in drop-down, but
because it is bound to the column it is showing multiple instances of
each (based on the column it is tied to).

Question: How can data bind a combobox to a datacolumn, but still
retain control of what choices are available from the drop-down list.
(only one of each)

Thanks,

Apr 17 '07 #2
Do you mean that you are navigating through a dataset, and you are using
the column in the dataset itself to do the binding for the combobox?

If that is the case, you need to bind your database to a list containing
just the values you want displayed. Note that if you do this, when you
cross a record where the value is in your form's dataset but not in the
dropdown, the field will display as a blank. To get around that, you can
set it to a dropdown combobox, not a dropdown list, and load a list of
values directly into the combobox instead of binding it.

Robin S.
---------------------------
<gl******@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>I have databound a Windows form ComboBox control to a DataSource and
DataMember and it is properly showing the data as I navigate through
the records. My question concerns the choices in the pull-down list
itself.

The Field is Priority and the only available choices should be "High",
"Low", "Do Not Call".

These are the only choices I would like to see in drop-down, but
because it is bound to the column it is showing multiple instances of
each (based on the column it is tied to).

Question: How can data bind a combobox to a datacolumn, but still
retain control of what choices are available from the drop-down list.
(only one of each)

Thanks,

Apr 17 '07 #3

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

Similar topics

2
by: bds | last post by:
I'm new to .net 2.0 and I'm trying to figure out the best way to create a form that has a couple of controls and one of the controls is a combo box with a data bound list of items from another...
2
by: Crazy Cat | last post by:
I am using a data-bound combobox with dropdownstyle set to dropdownlist. Teh combobox is bound to a bindingsource which is in turn bound to a table in my database. The table has only 4 rows and I...
8
by: | last post by:
I am sure this has been asked and answered, but here goes anyway... VS.Net 2005, VB.Net How can you display more than one field in the displaymember property of a combobox inside the...
3
by: Jimmy | last post by:
I'm not sure the subject line is a very clear description of my problem so... I have two relevant tables for this issue... the lookup table tblLookupItems with three fields . The control...
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
6
by: tbrown | last post by:
I have a combobox with items like this: {one,two,three}. The selected index is 0, so "one" appears in the combobox text. When the user drops down the list, and selects "two", for example, I...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
4
by: sree078 | last post by:
I've a list of items which I bound to multiple combo boxes. In the due course in the code...I had to add an item into one combo box...but I don't want it to be reflected into any other combo...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...

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.