Object Question

I am programming in DBASE 2000.  It is a mixture of DBASE and Delphi.  Since they don't have a DBASE 2000 or DB2K topic I will submit my question here.

I have a form that has a notebook with tabs....   My program goes to a certain directory reads all .DBF files into an array then creates a notebook1 object using the file names as tab names.  After I get the size of the array or how many elements are in it.  I use the element count to figure out how many grid objects I will need.  I want to have a grid per-tab.  This is so the user can click on the notebook tab that he wants and view the .DBF file in the grid.

My problem is this.  I don't want to go and create a set number of grids.   I want to be able to create how many I need acording to how many elements are in the .DBF array.  I need to know if there is a way to do this.  This what I tried but DBASE 2000 gets confused.

For i = 1 to FileArray.Size
   MyGridName := "Grid" + i
   MyGridName = New Grid(form.notebook1)
Next i

I was hoping this would loop through this and names each grid.  I.E. Grid1, Grid2, Grid3, Grid4,..etc

Then I could go and run another loop and assign value to each grid properties.....
  For i = 1 to FileArray.size
      With (Form.Notebook1.Grid + i)
         left := 1.00
         pageno := 2
  Next i

Please help.   I need to make this work.  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I've taken a standard 'Tabbed Notebook Dialog' from File->New->Other->Forms->Tabbed Pages. Delphi 6.

Then I've added TabSheets as a public member to the form.

The OK-button makes 5 new tabsheets.
The Cancel-button deletes all tabsheets.

Should work rightaway.

good luck,

unit Unit2;


uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ComCtrls, ExtCtrls;

  TPagesDlg = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    PageControl1: TPageControl;
    TabSheet3: TTabSheet;
    OKBtn: TButton;
    CancelBtn: TButton;
    HelpBtn: TButton;
    procedure OKBtnClick(Sender: TObject);
    procedure CancelBtnClick(Sender: TObject);
    { Private declarations }
    TabSheets : array of TTabsheet; // the new tabsheets

  PagesDlg: TPagesDlg;


{$R *.dfm}

procedure TPagesDlg.OKBtnClick(Sender: TObject);
  t : integer;
  newLength = 5;
  // set length of Tabsheets-array
  // create al Tabsheets
  for t := 0 to high(tabsheets) do
    tabsheets[t] := TTabSheet.Create(self);
    TabSheets[t].Parent := self;
    TabSheets[t].PageControl := PageControl1;
    TabSheets[t].Caption := 'Grid ' + inttostr(t);
    TabSheets[t].name := 'Grid ' + inttostr(t);

procedure TPagesDlg.CancelBtnClick(Sender: TObject);
  // delete all tabsheets
  for t := 0 to high(tabsheets) do

  // clear array

strongdAuthor Commented:
That is not what I am asking...  Basicly I am asking...   How do you make objects with variable names..???

You can't.

My problem is this.  I don't want to go and create a set number of grids.
so no static array.
I want to be able to create how many I need acording to how many elements are in the .DBF array.  
You want a dynamic array. (!)

if you for-loop through all the elements,
then you know how many elements you have,
and set the length of the dynamic array like this:
SetLength(tabsheets,[newlength]); (see previous example)

or while-loop through all the elements
and add with every iteration a new element:
while not (the end of dbase} do
  // set array-length 1 higher
  // create new tabsheet
  tabsheets[length(tabsheets)-1] := TTabSheet.Create(self);
  // go to next element in DBase

I need to know if there is a way to do this.
There is , but don't use variable names, but variable arrays :D

Use TabSheets[t].name := 'Grid ' + inttostr(t);
to set the name of a tabsheet.

For/while-loop through the array to find the sheet you want.
while assigned(TabSheets[t]) and (not TabSheets[t].name = 'Grid 2') do t := t+1;
result := Tabsheet[t];

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
strongdAuthor Commented:
None of the people answered the question.  How do I get my points back?

strongdAuthor Commented:
The problem was never solved.   What these people told me to do, didn't work.  First off, I was working with DBase2000.  Experts Exchange doesn't even have a DBASE2000 or DBASE section.  So I never got it working and took a different route.  

I took another job about 2 months after I submitted this question.  I can't remember what I accually did to get around this.

Hopefully I can get my some of my points refunded.

strongdAuthor Commented:
What TicketToTotalitarianism suggested never worked!  Why are you guys forcing me to give him the points????

What he suggested to try never worked!

I guess I will have to be careful of how many points I post... because you guys will force me to accept answer even if it is wrong...

strongdAuthor Commented:
Sorry... I am no longer working in the that area.  Even if I was, because I was working on classified data for the Air Force, I couldn't post the code anyway.  Anything I wrote on a classified system, it is classified.  The code becomes classified, and the Air Force owns it.   If I posted code that was "CLASSIFED" I could go to jail.  

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.