?
Solved

FREE TCOMPONENTLIST

Posted on 2002-06-15
4
Medium Priority
?
349 Views
Last Modified: 2010-08-05
FREE TCOMPONENTLIST

When I try to free TComponentList I get this error :

ACCESS VIOLATION,

and every time (after free method) when I try to use TComponentList named ComponentList.

How to solve this problem ?

Thanks.
0
Comment
Question by:ghjlk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7080501
you should show how you free and access your list
0
 

Author Comment

by:ghjlk
ID: 7080565
//first oncreate event
componentlist.create;

//then two methods of create components
componentlist.add &
componentlist.insert

//in componentlist I put Forms, ActiveX components and others.


//section new
while componentlist.count>0 do
TControl(componentlist[0]).Free;

componentlist.free;
componentlist.create;

Thanks.
0
 

Author Comment

by:ghjlk
ID: 7080667
Sorry :
componentlist:=TComponentlist.create;
0
 
LVL 7

Accepted Solution

by:
Cynna earned 1000 total points
ID: 7080733
ghjlk,

Try creating componentlist like this:
 
  componentlist:=TComponentlist.Create(FALSE);

This will ensure that componentlist.free doesn't try to free components that you already freed before.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question