Board index » delphi » IndexDefs - am I using the right property?

IndexDefs - am I using the right property?

Hi,

I have a DBF file which has about 10 different indexes in it - and I
can see them in the Object Inspector when I drop down the IndexName box
I can see them all.

However, when I use the following code, IndexDefs.Count returns zero -
unless I'm using the wrong properties but I can't see which other ones
to use?

with Table1 do
begin
     Close;
     TableName:=Edit1.Text;
     Open;
     if IndexDefs.Count<>0 then
        for c:=0 to Table1.IndexDefs.Count-1 do
            ListBox1.Items.Add(Table1.IndexDefs[c].Name)
     else
         ListBox1.Items.Add('<no indexes>');
end;

Any ideas?

Cheers,

- Bob -

Sent via Deja.com http://www.deja.com/
Before you buy.

 

Re:IndexDefs - am I using the right property?


What is wrong with:

Table1.GetIndexNames(ListBox1.Items);

ps. You don't need to open the table for the call to GetIndexNames.

<bob.br...@opus.co.nz> schreef in bericht
news:8gf2cp$6oq$1@nnrp1.deja.com...

Quote
> Hi,

> I have a DBF file which has about 10 different indexes in it - and I
> can see them in the Object Inspector when I drop down the IndexName box
> I can see them all.

> However, when I use the following code, IndexDefs.Count returns zero -
> unless I'm using the wrong properties but I can't see which other ones
> to use?

> with Table1 do
> begin
>      Close;
>      TableName:=Edit1.Text;
>      Open;
>      if IndexDefs.Count<>0 then
>         for c:=0 to Table1.IndexDefs.Count-1 do
>             ListBox1.Items.Add(Table1.IndexDefs[c].Name)
>      else
>          ListBox1.Items.Add('<no indexes>');
> end;

> Any ideas?

> Cheers,

> - Bob -

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Other Threads