C++ Builder: TListView.Clear() leads to Access Violation Error

Hi everyone!

Please help to solve a problem. I wrote a piece of software with C++ Builder 6. There is a component lsvParticle of TListView type on the form, and lsvParticle->ViewStyle = vsReport. In this component bright spots coordinates on an image are listed. When any row is selected in lsvParticle the corresponding spot on the image become contoured. After loading of a new image the list in lsvParticle must be refreshed. To do this I try to clear it:

lsvParticle->Clear();

but if any row in lsvParticle is selected before clean, then the program throw error "Access violation at address 004AE7A0. Read of address 00000004"!

I've tried to fix it by:

1
2
lsvParticle->ClearSelection();
lsvParticle->Items->Clear;


- without success. But it is necessary to switch from one image to another with one row selected. What should I do?
Topic archived. No new replies allowed.