Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2003, 12:08 PM
Authorized User
 
Join Date: Jun 2003
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default how can i clean all itens im a COMBOBX list

Hi i need some help to solve a problem with the DataSource in a COMBOBOX.
The question is "How can i clean all the itens in a Combobox if i use the DataSource to browse data in a database????".
I use the code below to fill a combobox:

this.cboSubfamilia.DataSource = thisDataSet.Tables ["subfamilia"];
this.cboSubfamilia.DisplayMember = "subfamilia";

After to make the described one above, as I can clean all itens of same combobox so that he does not appear nothing in its listing.
 
Old September 2nd, 2003, 01:59 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Thomaz,

You can use the Clear method of the Items collection of your Combobox, like this:

Code:
this.cboSubfamilia.Items.Clear();
If you had some default text in the Combo, you may need to reset the Text property as well:
Code:
this.cboSubfamilia.Text = ""
Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old September 4th, 2003, 11:35 AM
Authorized User
 
Join Date: Jun 2003
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi...

To solve the problem above i use the code below:

this.cboTribo.DataSource = null;
this.cboTribo.Items.Clear ();

Thanks a lot IMAR for answer my question...





Similar Threads
Thread Thread Starter Forum Replies Last Post
clean white space and comments Kabe XSLT 0 June 15th, 2007 03:34 AM
Clean Temporary Internet Files in IE6 through VC+ Divesh4u Visual C++ 1 June 9th, 2006 06:20 AM
Need advice to clean up my date manipulation code jasoncompo Beginning VB 6 1 June 2nd, 2006 01:29 PM
how can i cover all itens of a list view? thomaz C# 1 November 30th, 2005 04:30 AM
code to clean and modify dbase lord_brighton Access VBA 0 August 8th, 2004 07:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.