Using ListView

burd27

Member
Licensed User
I have been playing around with the ListView control library and are having a few hassles that is no doubt a lack of understanding on my part.

What I have tried to find out is how to manipulate the Listview tables to avoid unnecessary load on the CPU or consumption of memory while the application is running. My understanding is that Table and Listview work almost identicle, except that Listview has extra features. (?)

The app' that I am working on utilises two Listview tables. One of them is "invisible" and is populated when the application is started using LoadCSV. This table is regularly accessed and values read, added and removed. So the table itself remains active all the time in the background.

The second Listview table that I have is on a form that is only accessed every now and then. It has the potential to grow into a large table, so my intention is to only load it up when needed and get rid of it as soon as I'm finished with it, so that memory is freed up, etc. During this use the Form and its Table are made visible.

Occassionally though, I need to manipulate this second table without actually viewing the Form that it is on. In these cases I am intending to create the Listview table on its normal form, but not actually Show the form. Once the manipulation is completed, then I once again want to remove it from memory.

My question is how to go about doing all this using the RemoveAllRows, Close, Dispose, etc (or any other) methods. To achieve my goal of easing the load on the CPU and freeing up memory, should I only look at removing the rows (data) but leave the Table intact, or should I be "unloading" (disposing?) everything associated with it.

Which ever path is advisable, what methods should be used and in what order.

I have done heaps of experimentation and I keep coming up with errors when trying to recreate a "disposed" listview (table), or the table not being "repopulated" when using LoadCSV, etc. These problems are only happening when I am trying to access the tables multiple times.

I'm obviously missing some minor key point, but have been unable to put my finger on it.

Any advice will be much appreciated (as always).

Burd.
 
D

Deleted member 103

Guest
Hi burd27,

I do not understand so many English, therefore I understand your problem not completely. Please upload part from code, so that I better understand and can help


Ciao,
Filippo
 

burd27

Member
Licensed User
Hi Filippo,

I've been playing around with the code just experimenting, so I don't have something containing a specific problem.

Simply, what I would like to know is if I create a ListView table on a non-main form and want to remove it from memory once I've finished with it (without closing the application), how should I do that so that If I want to create it again, that it still works.

At the moment, if I leave the table theer but just RemoveAllRows, when I go back to it later, it won't reload the CSV file. Also, if delete the table totally by using the Dispose method, when I go back to ceate the table I get an error telling me that there is no object.

Let me know if you still want a sample code. If so I write one detailing the problems.

Thank you
Burd
 

agraham

Expert
Licensed User
Longtime User
Top