Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I need to clear the selection out of a combobox when it loads. How do I do this?

Posted on 2006-11-03
5
Medium Priority
?
278 Views
Last Modified: 2010-04-23
I have a combobox that is bound to a datatable (in a relational database). There are 4 items in the tabel that it pulls the data from. When I load the form it comes up with the first item in the list. Unfortunately the item that is shown in the combobox when it loads or another item is saved to the database is duplicated in the combobox list. I still have 3 items in the combobox, but whatever was the last item in it when it was saved is duplicated. How do I stop this so it will always show all the different items listed and still be bound to the table I need? The only way I can get it to show the 4 different items is to unbind it from the related table. But then it won't update the table because of that. I don't want to enter the items in the items list property because then it would not show any other items. This list will change depending what is entered into it from another table.

Example:

Combobox A (actual)                                            Combobox B (waht I need)
Item 1                                                                 Item 1
Item 2                                                                 Item 2
Item 3                                                                 Item 3
Item 1                                                                 Item 4


Thanks




 
0
Comment
Question by:grouchyfd
5 Comments
 
LVL 8

Expert Comment

by:razo
ID: 17867381
can u post ur code?
0
 
LVL 35

Assisted Solution

by:YZlat
YZlat earned 750 total points
ID: 17867923
ComboBox1.Items.Clear()
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17867991
wait, how do you load data into your ComboBox?
0
 

Author Comment

by:grouchyfd
ID: 17869056
The collection of the list is loaded when the form loads:
Me.TableAdapter1.Fill(Me.DataSetName.Table)
This was generated automatically when I bound the combobox to the datasource.
0
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 750 total points
ID: 17872841
use this
Combobox1.SelectedIndex = -1
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question