Sign in to follow this  
Cybrosys

[.net] Updating a listbox efficiently with data

Recommended Posts

Cybrosys    186
This is my problem. I've programmed a nice sfv checker but the problem i'm having is updating my listview once data has been modified. At first i just cleared the list and rebuilt everything from scratch because the data wasn't that much so it was the easiest solution. However, this isn't acceptable when the Library grows with alot of entries because rebuilding starts to take time. How can i do this the right way? Have data and display certain parts of it in columns in a list? Should i use some of the database stuff? If so, could someone give some starting tips etc because i've never used 'em before.

Share this post


Link to post
Share on other sites
Machaira    1033
Listbox or Listview?

'for listbox
ListBox1.Items(3) = "Changing item 4"
'for listview
ListView1.Items(3) = New ListViewItem("Changing item 4")


If you know what data has changed, it's a piece of cake to update the control.

Share this post


Link to post
Share on other sites
Cybrosys    186
Ah nice, though it'll be a hassle because the item needs to know which node item it belongs to in that case. One way of doing it would be to have the NodeItem have a event that gets called once it's tag data was altered and then update itself ,but don't i have to let the listview know that the item's text changed aswell?


If i wanted to use databases or such, how would one go about doing this etc?

Share this post


Link to post
Share on other sites
Krisc    494
I am using the listview for an RSS reader and I have created a custom class that inherits from TreeNode (the node that TreeView uses). It allows me to have extra properties like an ID, file tag and a url tag that I can access using Reflection.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this