Board index » delphi » Index in Delphi

Index in Delphi

How can I do this

    for i := 1 to 10 do
        begin
            TextBox(i) = i;
        end;

This is the equivalent in VB

    for i = 1 to 10
        TextBox(i) = i
    next i

How can I create 10 TextBox with the same name but with 10 differente index
to access value in a loop ??? I would like create control at design time...

Realy thank

Rob...@hebdomag.com
Visual Basic 6.0 MCP who learn Delphi 4 ...???... ;-)

 

Re:Index in Delphi


I'm not sure i understand... you want to create 10 visual components
runtime??

-Kim

Robin lEBLOND skrev i meddelelsen ...

Quote
>How can I do this

>    for i := 1 to 10 do
>        begin
>            TextBox(i) = i;
>        end;

>This is the equivalent in VB

>    for i = 1 to 10
>        TextBox(i) = i
>    next i

>How can I create 10 TextBox with the same name but with 10 differente index
>to access value in a loop ??? I would like create control at design time...

>Realy thank

>Rob...@hebdomag.com
>Visual Basic 6.0 MCP who learn Delphi 4 ...???... ;-)

Re:Index in Delphi


var
    MyEdits: array [1..10] of TEdit;
    x: integer;

begin
    for x := 1 to 10 do
    begin
        MyEdits[x] := TEdit.Create(Self);
        MyEdits[x].Text := IntToStr(x);
    end;
end;

Woody

Quote
Robin lEBLOND <rob...@hebdomag.com> wrote in message

news:WYWp3.39671$Q4.117924@wagner.videotron.net...
Quote
> How can I do this

>     for i := 1 to 10 do
>         begin
>             TextBox(i) = i;
>         end;

> This is the equivalent in VB

>     for i = 1 to 10
>         TextBox(i) = i
>     next i

> How can I create 10 TextBox with the same name but with 10 differente
index
> to access value in a loop ??? I would like create control at design
time...

> Realy thank

> Rob...@hebdomag.com
> Visual Basic 6.0 MCP who learn Delphi 4 ...???... ;-)

Other Threads