If the older lines in the list are no longer needed they could periodically
well. A reset or clear button is a good idea as well.
To further this point, I find it quite likely that about 2 days of real
use and your users will be
wanting the ability to "reset" the list view back to zero items because
there are just too many to make it
worth scrolling through.
I recommend, like everyone else, to use a virtual list control.
* Add a button to reset the list data.
* When your application receives data you want to add to the list control,
add it to a collection object
(database, vector, list, etc) instead. Virtual List control should go
to this collection to get it's data.
* Increase the rowcount of your list control by 1 row.
* Append this item also to a text file (this is optional, but doing it
line by line makes it a bit quicker if the
user asks to generate a log of a million items because it's already
generated).
* If user clicks on button to create text file, you already have it, just
copy it somewhere they can access it.
* If user closes app, delete the text file (it's a temporary file anyway)
and if you used a database, delete
all of those rows, unless you want the data to persist across
application startups.
* If user clicks on the "Reset List" button, clear the list by setting
it's rowcount to 0 and delete all the rows
you added to the database and / or collection.
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:OZ62XcgSJHA.4084@TK2MSFTNGP04.phx.gbl...
I wouldn't load more than a few hundred items into a list control
directly. They start to run really slowly after a while and it takes a lot
of time.
You can use the EnsureVisible() call with a virtual list and you would
just add your data to your object array (that you would use to supply the
information to the control as it requests it). That data could even be
in an external file like an .MDB file if you need to sort it different
ways.
You still have all the data (I typically use an object array of some
sort) so you can write it to the file easily from the array.
I'm sure everyone here would be happy to help if you have any specific
questions along the way, but check out the link I posted in the previous
message... well, here is again since it's still on my clipboard:
http://msdn.microsoft.com/en-us/library/ye4z8x58(VS.80).aspx
Tom
"Gary" <Gary@discussions.microsoft.com> wrote in message
news:19217028-DD8C-4D9A-A4DB-125C0BF61039@microsoft.com...
Thanks a lot Tom.
So a few hundred items (< 500, 000) ok for a normal CListCtrl ?
I did ask you a few question in my reply to your previous comment
regarding
usage of virtual list control.
In my application I need to keep on appending items to the control as
they
are received forever. I automatically scroll to the last item using
EnsureVisible().
My only concern will be when I want to save the items from the list
control
to a text file when the user prompts me to do so.
I don't need to load any items at startup, my list control will be
empty.
Thanks,
Gary
"Tom Serface" wrote:
I agree with some of the others that after a few hundred items you will
want
to consider a virtual list control. They are very easy to set up, the
data
can come from just about anywhere, and they are way quicker for
displaying.
You can even have some of the data cached in a file or database or
whatever
so long as it can be accessed when needed. That said, I don't think
you'll
reach the limit. Before that happened no one would be willing to use
your
application.
Tom
"Gary" <Gary@discussions.microsoft.com> wrote in message
news:FCACADAD-7521-4333-832B-F1F653143BAF@microsoft.com...
Hi,
I would like to know how many items can I insert into a CListCtrl....
?
I am not using virtual list control.....
I am just using CListCtrl in a form view..........
I just want to keep on adding possibly millions of items at runtime
and
save
them to a text file is user wants to...........
I don't want to load those many items..........
InsertItem() takes "int" as parameter index......so CListCtrl should
atleast
support
(-2,147,483,648 to 2,147,483,647) items..........
I just want to make sure I can add as many items as I want at run
time...
Any pointers would be apprciated.
Thanks,
Gary