473,387 Members | 1,516 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,387 software developers and data experts.

Clearing items before refreshing dataset from listbox

Hi

I have a ListBox which is binded to a dataSet. When I need to refresh
this dataSet, it works, but the old entries don't get removed from the
listbox. Items.Clear() doesn't work when a DataSource is set.

How would I clear all the items from the ListBox before refreshing the
dataset?

thanks
Jun 27 '08 #1
1 2484
Hi

ListBox is a mirror of dataset in this case. If you want to clear listbox
clear the source, or just detach.

Regards, Alex
[TechBlog] http://devkids.blogspot.com

sHi
s>
sI have a ListBox which is binded to a dataSet. When I need to refresh
sthis dataSet, it works, but the old entries don't get removed from
sthe listbox. Items.Clear() doesn't work when a DataSource is set.
s>
sHow would I clear all the items from the ListBox before refreshing
sthe dataset?
s>
sthanks
s>
Jun 27 '08 #2

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

Similar topics

3
by: gdbjohnson-AT-yahoo-dot-ca-nospamplz | last post by:
I have a ListBox built of a simple custom object for the ListItems used to be able to hold a Data Value, and a Display Value, with accessors for each. I have overridden the ToString method to...
3
by: Brad | last post by:
I'm working with a DataGrid in C#, and the user needs to be able add and remove columns from the DataGrid on the fly, without opening and closing the form. The scenario is this. I have a setup...
3
by: Prasad | last post by:
Hey All, I am having a little trouble with the ListBox's Items collection property. I am populating the ListBox with data contained in an SQL table using SQLDataAdapter and DataSet. I have...
3
by: Baren | last post by:
Hi! I have a generalized Stored Procedure to get the listbox items in a datareader.Then i am binding the datareader to the listbox. For different pages and different conditions i need to hide...
2
by: amber | last post by:
Hello I'm keeping this list busy! : Okay, now I'm trying to clear a listbox The way I have it set up, the user can either enter a value into a textbox, then hit a button, and 1 specific record is...
0
by: Tony Botelho | last post by:
I am fairly new to VB.NET and I am having some difficulty working with a bound listbox. On a simple form, I open a connection to my database and load a dataser. I then bind a listbox to the the...
3
by: Angel Blue01 | last post by:
I have a form with a binding navigator that draws from a database via drag-and-drop-created controls. I'm filling a listbox with the results of a query. The listbox contains data related to the...
5
by: BlackBox | last post by:
I have a Listbox1 in the main form and I can add listbox1 items in the parent form. But when I close the parent form Listbox1 in the main form does not get refresh. I need to re-open the app. ...
2
by: gnosys | last post by:
In ASP.Net 1.1 using C#, I'm trying to dynamically change the background colors of certain listbox items based on some criteria. For example:
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.