Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
332
UltraListViewItem seems disposed too early..
posted

I am using the ListView in Details mode; and I would like to create a listviewitem regardless of whether I am adding to the ultraListView or not. It seems this is not possible since the only way I have found to creat a new listviewitem is to call the Add method of the ultraListView control.

1. Is there a way to create a listviewitem (object) without calling the Add method?

If there is a way, that would be great; since not all listviewitems I will create should automatically be displayed in the ultraListView. Some items are stored in another generic-list for later use. For example, when the user clicks on a specific button, I would append the ultralistviewitems to the current ultraListView control. My current means of implementation is simply to create the new item with the Add method, populate its columns, and then delete it from the ultraListView. However I am afraid this has a major performance impact to my client application as I may be required to process 100s if not 1000s of such routines per second. My app performance atm - at about 5Hz, my TaskManager reports a CPU usage of about 20%; at about 100 Hz, we looking at about 60%; and at 1 KHZ, we close to about 100% CPU usage (my machine 2.2GHz/2GB ram).

 2. I have also tried to create a listviewitem (object) during InitializeComponent to initialize my global variable. After the global variable was initialized (with the add method), I would immediately remove the item from the ultraListView. Then when the time came to use an ultraListViewItem, I would clone my original global variable, and work with that instead. However I keep getting an error saying:

"The SubItems collection cannot be accessed when the parent UltraListViewItem is not associated with an UltraListView control"

Which leaves me with my current (and only) option - which is to Add the item, work with it, and then Remove it if it is not immediately needed.

 Any ideas?

thanks,
-kel-