ComboBox issue

  • Thread starter Thread starter CJ Taylor
  • Start date Start date
C

CJ Taylor

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
 
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
 
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
 
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 said:
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

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
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
 
Back
Top