ListView VirtualListSize Problems

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

Hi,

I am trying to use a 2.0 virtual listview, I thought it was all working fine
until I tried to remove an item from it. For example if the top of the list
is visible and I do:

myListView.VirtualListSize = myListView.VirtualListSize - 1;

It works fine, the scrollbar shrinks slightly so it's obvious the bottom has
been removed, but if the scrollbar is moved down slightly at all the line
throws the following exception:

System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Windows.Forms.ListView.Scroll(Int32 fromLVItem, Int32 toLVItem)
at System.Windows.Forms.ListView.set_TopItem(ListViewItem value)
at System.Windows.Forms.ListView.set_VirtualListSize(Int32 value)

Any ideas?

Thanks,

Stuart
 
Back
Top