Главная страница | назад





Article #10538: How do I create an array of TStringList?

Question:I want to create an array of TStringLists to use in my application. But I keep getting access violations when I try this: TStringList * MyStrings = new TStringList[5]; How can I create this array?

Answer:The reason you are getting th AV is VCL objects must be created on the heap. Here is a code snippet that creates an array of TStringLists.:

typedef TStringList * MyLists;

MyLists * MyStrings = new Test[10];

for (int i =0; i <10; i++)

{

MyStrings[i] = new TStringList;

}

Last Modified: 28-OCT-99