Per Knopfdruck einen eintrag weiter runter in der ComboBox



  • Hallo

    nochmal ein kleines Problem...

    Ich möchte wenn ich auf ein BitBtn drücke das er einen Eintrag in der ComboBox weiter runter geht.

    Hier mein Code

    void __fastcall TForm3::BitBtn2Click(TObject *Sender)
    {
    int i;
    int anzahl;
    anzahl = ComboBox1->Items->Count;
    for (i = 0; i < anzahl ; i++) {
    ComboBox1->ItemIndex = i;
    }
    }
    //---------------------------------------------------------------------------
    

    Er markiert jedoch immer den letzten eintrag und nicht einen weiter...

    kann mir jemand vill. Helfen ?!

    Liebe Grüße



  • Hallo

    Warum eine Schleife?

    int i = ComboBox1->ItemIndex;
    if (i < ComboBox1->Items->Count -1)
      ComboBox1->ItemIndex = i +1;
    

    bis bald
    akari


Anmelden zum Antworten