1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram

  5. Delphifan Magazine
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

please help how to use ( for )??

Discussion in 'Delphi Help&Requests' started by Maher Tannous, Jul 24, 2015.

  1. Maher Tannous
    Offline

    Maher Tannous DF Junior

    please
    how to use ( for ) in this
    sbutton1.caption:=listbox1.Items[0];
    sbutton2.caption:=listbox1.Items[1];
    sbutton3.caption:=listbox1.Items[2];
    sbutton4.caption:=listbox1.Items[3];
    sbutton5.caption:=listbox1.Items[4];
    sbutton6.caption:=listbox1.Items[5];
    sbutton7.caption:=listbox1.Items[6];
    sbutton8.caption:=listbox1.Items[7];
    sbutton9.caption:=listbox1.Items[8];
    sbutton10.caption:=listbox1.Items[9];
    sbutton11.caption:=listbox1.Items[10];
    sbutton12.caption:=listbox1.Items[11];
    sbutton13.caption:=listbox1.Items[12];
    sbutton14.caption:=listbox1.Items[13];
    sbutton15.caption:=listbox1.Items[14];
    sbutton16.caption:=listbox1.Items[15];
    thanks a lot
     
  2. mspitz
    Offline

    mspitz DF Member

    RE:

    You must create the buttons dynamically in your form. It would be a code similar to this:

    Code:
    procedure TForm1.FormShow(Sender: TObject);
    var
      MyButtons: array of TButton;
      i: Integer;
    begin
      SetLength(MyButtons, ListBox1.Items.Count);
      for i := 0 to (ListBox1.Items.Count-1) do
      begin
        MyButtons := TButton.Create(Form1);
        MyButtons.Parent := Form1;
        MyButtons.Caption := ListBox1.Items;
        ...
      end;
    end;
    
     
  3. xyberx
    Offline

    xyberx DF Senior

    RE:

    For I := 0 To Listobox1.Items.Count -1 Do
      Self.FindComponent('sbutton' + IntToStr(I +1)).caption := Listobox1.Items.Text;


     
  4. Maher Tannous
    Offline

    Maher Tannous DF Junior

    thanks a lot
     

Share This Page