Adding columns to a DBGrid in runtime.

Hi all,

I have an in memory table that I am using, adding fields dynamically
at runtime.

I add my field definitions as below.


    md.FieldDefs.Add('ID', ftLargeInt, 0, True);
    md.fielddefs.Add('Name', ftString, 30, True);


  while something do

     md.AppendRecord([CrewRecord.ID, CrewRecord.NAME]);  // error here!


But I get a "List Index out of Bounds" error message when I try to
append a record to the table.

This works perfectly when I have my field definitions made at run
time, but I would like to do it dynamically if possible!

I have a feeling it is something to do with the dbgrid that I am using
to view the records - initially, there are no columns, because they
are created at run time.

Do I have to create the DBGrid columns dynamically also? Do I have to
specify the field type? How is this done?

Basically, I would like to know where I am going wrong.



Seo mo sini!