473,405 Members | 2,334 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,405 software developers and data experts.

ComboBox issue

Hey everyone,

This is a logic problem, that I don't really know how to solve. Well, I do,
I just don't want to do it this way.

I have a databound combo box, and I want to add a <None> item to it so they
don't have to select a value inside the combo box, However, being databound
you can't add items after its been built, and before it seems to erase them.

How would I go about doing this?

Thanks,
CJ
Nov 20 '05 #1
3 863
CJ:

I found a work around, so there is probably a better method... but you cna
do a few things. 1) You can Add a DataRow and add the value <NONE> to the
field you are binding to, this will cause it to show up in the list like any
other value. 2) You can get the values and create an array out of them,
then bind to the array - probably not what you need in this case, but I
figured I'd mention it.

HTH,

Bill
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:vv***********@corp.supernews.com...
Hey everyone,

This is a logic problem, that I don't really know how to solve. Well, I do, I just don't want to do it this way.

I have a databound combo box, and I want to add a <None> item to it so they don't have to select a value inside the combo box, However, being databound you can't add items after its been built, and before it seems to erase them.
How would I go about doing this?

Thanks,
CJ

Nov 20 '05 #2
Hey William,

Yeah I was thinking of the exact same approaches, was just wondering if
there was something better out there I didn't know about...

-CJ
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...
CJ:

I found a work around, so there is probably a better method... but you cna
do a few things. 1) You can Add a DataRow and add the value <NONE> to the field you are binding to, this will cause it to show up in the list like any other value. 2) You can get the values and create an array out of them,
then bind to the array - probably not what you need in this case, but I
figured I'd mention it.

HTH,

Bill
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:vv***********@corp.supernews.com...
Hey everyone,

This is a logic problem, that I don't really know how to solve. Well, I

do,
I just don't want to do it this way.

I have a databound combo box, and I want to add a <None> item to it so

they
don't have to select a value inside the combo box, However, being

databound
you can't add items after its been built, and before it seems to erase

them.

How would I go about doing this?

Thanks,
CJ


Nov 20 '05 #3
Why not bind to a hidden combo box and use a visible unbound combo in the
UI. A little code to sync and you have the ability to add other options to
the combo.
- Perry

"One Handed Man [ OHM# ]" <OneHandedMan{at}BTInternet{dot}com> wrote in
message news:uL*************@tk2msftngp13.phx.gbl...
This question has come up many times. My solution was to use the RowUpdated Event and check for the <None> or whatever it is called, if not there, then insert it.

A little messy, but it worked for me. I must admin, there should be
provision for static Items really.

Regards - OHM
CJ Taylor wrote:
Hey William,

Yeah I was thinking of the exact same approaches, was just wondering
if there was something better out there I didn't know about...

-CJ
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...
CJ:

I found a work around, so there is probably a better method... but
you cna do a few things. 1) You can Add a DataRow and add the
value <NONE> to the field you are binding to, this will cause it to
show up in the list like any other value. 2) You can get the
values and create an array out of them, then bind to the array -
probably not what you need in this case, but I figured I'd mention
it.

HTH,

Bill
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:vv***********@corp.supernews.com...
Hey everyone,

This is a logic problem, that I don't really know how to solve.
Well, I do, I just don't want to do it this way.

I have a databound combo box, and I want to add a <None> item to it
so they don't have to select a value inside the combo box, However,
being databound you can't add items after its been built, and
before it seems to erase them.

How would I go about doing this?

Thanks,
CJ


Regards - OHM# OneHandedMan{at}BTInternet{dot}com

Nov 20 '05 #4

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

Similar topics

2
by: ross kerr | last post by:
Hi all, I have a control that extends the ComboBox object. It updates the selected item based on what the user enters in the text area. In the OnLeave event of the combobox, the selected...
3
by: Lubomir | last post by:
Hi, I have a combobox and datagrid in a form. When an Item is selected from a combobox, a method is called, which will make selection from a database according selected item and populate...
5
by: malcolm | last post by:
I'm trying to make a combo box custom control (Windows Forms .NET 1.1 c#) that can behave like a label programatically at run time. This is actually a strong feature request by our customers. I...
1
by: pagates | last post by:
Hello All, I seem to have found a problem using a ComboBox. If you bind a ComboBox to an ArrayList of classes, setting the DisplayMember to one field in the class and the ValueMember to...
6
by: Juan Pedro Gonzalez | last post by:
I wanted to add a Combobox to a toolbar... Kind of the look you get on VisualStudio's toolbar. I've been able to find some VB 6 samples, but the placeholder option is no longer available for...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
1
by: amber | last post by:
I'm having an issue with a combobox that is making no sense to me at all. I have a form with several comboboxes/textboxes. The values in these boxes are based on a datarowview, which is based on...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
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...
2
by: =?Utf-8?B?V29ua28gdGhlIFNhbmU=?= | last post by:
Hello, I have a ComboBox that has a DataContext set on it. When a PropertyChanged event is fired (based on a static instance of some class), I'd like to update the DataContext on the combo, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.