Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of Tabsheets 2

Status
Not open for further replies.

ruan123

Programmer
Jul 23, 2004
23
ZA
Hi

Is it possible to create an array of tabsheets, if it is
how do you create it.

I've tried

var
tabsheets : array of TTabSheet;
begin
tabsheets[0] := TTabSheet.Create(Form1);--Error

but gets an access violation at the error line!

I am using Delphi 7

Thank you
 
The error occurs because you have not specified a length for your array. Either define it as

tabsheets: array[0..0] of TTabSheet

or alternatively, before you create the tabsheet set the length using SetLength, i.e.

SetLength(tabsheets, 1)

Steve
 
Consider using a TPageControl which you can add created tabsheets to. It will act as a container and can be used as an array. By specifying an array index for the Pages property, you can access each tabsheet that you added to it.
Check out the delphi help for more info.

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top