Announcement

Collapse
No announcement yet.

ComponentCount

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ComponentCount

    Hallo Leute..

    ich habe mal eine Frage.

    Geht das auch in VB ?
    Bestimmt.
    Aber ich weiss nicht wie.
    Ich habe auf mein Formular 20 Buttons.
    Die muss ich "enabled" schalten.
    Kann mir einer helfen ?


    procedure TForm1.CheckBox1Click(Sender: TObject);
    var i : integer;
    begin
    for i := 0 to ComponentCount -1 do
    begin
    if Components[i] is tButton then
    begin
    tButton(Components[i]).Enabled := CheckBox1.Checked;
    end;
    end;
    end;


    Gruss Sascha

  • #2
    Hi !

    Ich habe eine Lösung gefunden
    Ganz einfach "eigentlich"

    for Each ctl as Control in Me.Controls
    If TypeOf ctl is Button then
    DirectCast(ctl,Button).Enabled = CheckBox1.Checked
    end if
    Next ctl

    Gruss Sascha

    Comment

    Working...
    X