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

ComboBox - Losing binding

Hey Guys&Gals

my combo box is never empty it always have the text from the first
member of the table... Plz help
my code:

this.cbo.DataSource = SearchData.Tables["Name"];
this.cbo.ValueMember = "ID";
this.cbo.DisplayMember = "Name";
this.cbo.SelectedIndex = -1;
this.cbo.Text = " ";

Sunny

Oct 24 '06 #1
3 1351
It's because it is databound.
If it is databound it will not allow you to put "" as the text because "" is
not in the datasource.
Either put "" in the datasource (in that table) or rethink your use of the
combobox (e.g. use items instead).

"s2****@gmail.com" wrote:
Hey Guys&Gals

my combo box is never empty it always have the text from the first
member of the table... Plz help
my code:

this.cbo.DataSource = SearchData.Tables["Name"];
this.cbo.ValueMember = "ID";
this.cbo.DisplayMember = "Name";
this.cbo.SelectedIndex = -1;
this.cbo.Text = " ";

Sunny

Oct 25 '06 #2
Not sure what version you're using, but try this:
http://support.microsoft.com/kb/327244

/claes

<s2****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hey Guys&Gals

my combo box is never empty it always have the text from the first
member of the table... Plz help
my code:

this.cbo.DataSource = SearchData.Tables["Name"];
this.cbo.ValueMember = "ID";
this.cbo.DisplayMember = "Name";
this.cbo.SelectedIndex = -1;
this.cbo.Text = " ";

Sunny

Oct 25 '06 #3
Thanks Claes, I tried the solution on the link. Its not working most
probably because i am using .NET 1.1.
http://forums.microsoft.com/MSDN/Sho...55631&SiteID=1

I asked the question in microsoft forum and they told me no solution to
this problem :(

Y me !!!!@#@!#???????????
Claes Bergefall wrote:
Not sure what version you're using, but try this:
http://support.microsoft.com/kb/327244

/claes

<s2****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hey Guys&Gals

my combo box is never empty it always have the text from the first
member of the table... Plz help
my code:

this.cbo.DataSource = SearchData.Tables["Name"];
this.cbo.ValueMember = "ID";
this.cbo.DisplayMember = "Name";
this.cbo.SelectedIndex = -1;
this.cbo.Text = " ";

Sunny
Oct 25 '06 #4

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

Similar topics

1
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from...
3
by: amber | last post by:
Hello, I have 6 comboboxes, that I thought I could bind to the same datasource, and have them display different 'selectedvalue's', but apparently I can't... My code is as follows: dim drv as...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
2
by: shumaker | last post by:
I have a combobox that is very much like the one found in the RSS project here: http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/ My projectNameComboBox basically is filled with a...
5
by: Joe | last post by:
Hi I am adding a class to a ComboBox - and all is fine except that I fill the combobox on the Form_Load Method and it causes the method private void comboBox2_SelectedIndexChanged(object...
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...
19
by: active | last post by:
I'm using a ComboBox to display objects of a class I've defined, say CQQ. Works great except somehow I occasionally set an Item to a String object instead of an object of type CQQ. It looks...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
2
by: David Jackson | last post by:
Hello, I have an unbound DataGridView of which one of the columns is a ComboBox colum containing category data, plus an additional option called <newSo when the ComboBox is dropped down it looks...
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
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:
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
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
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
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,...
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.