Forum: PC-Programmierung VC#: ComboBox1 Objekt an Methode übergeben


von Gast (Gast)


Lesenswert?

Hallo,

eine Methode soll eine ComboBox mit einem Text oder Wert befüllen.
Welche combobox das sein soll, bekommt die Methode beim Methodenaufruf 
übergeben.

ref und objekt habe ich ohne Erfolg probiert.

Vermute schon, das das irgendwie geht. Weiß jedoch noch nicht wie.
Vielleicht kann mir hier jemand weiterhelfen.

von Markus V. (valvestino)


Lesenswert?

Versuch's mal damit:
1
void accessComboBox( ComboBox myComboBox )
2
{
3
    ...
4
    myComboBox.Items.Add( "Text" );
5
    ...
6
}

von fubu1000 (Gast)


Lesenswert?

Hallo,
Du hast zwar nicht angegeben obs Visual Studio 2005 und C++ ist, aber 
ich rate
mal ja!

private: void CmbBoxWrite(int CmbBox , String ^Text)
              {
                 switch(CmbBox)
                  {
                     case 1:
                      {
                          ComboBox1->Item->Add(Text);
                          break;
                      }
                     case 2:
                      {
                          usw. und sofort!!!
                      }
                      ........
                  }
              }


Vielleicht hilft es dir ja.
gruss fubu

von Gast (Gast)


Lesenswert?

danke hat geklappt

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.