Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi.

Ich habe folgendes Problem. Ich lasse mir während der Laufzeit über einen Button für mehrere ListBox Einträge Labels erzeugen mit zusammengefasstem Inhalt. Für jedes Label werden noch 3 CheckBoxen erzeugt. Je nachdem welche CheckBox aktiviert wird soll eine Methode aufgerufen werden, welche die Daten in der ListBox entsprechend überarbeitet.

        public void boxenErstellen(int height, int lane, string m1, string m2)

        {

            int y = height;


            CheckBox cb1 = new CheckBox();

            cb1.Name = ("cb1_" + Convert.ToString(lane));

            cb1.Location = new System.Drawing.Point(400, y);

            cb1.Width = 30;

            cb1.Text = "1";

            Controls.Add(cb1);


            CheckBox cb2 = new CheckBox();

            cb2.Name = ("cb2_" + Convert.ToString(lane));

            cb2.Location = new System.Drawing.Point(430, y);

            cb2.Width = 30;

            cb2.Text = "0";

            Controls.Add(cb2);

         //   if (cb1.Checked == true)

         //  { mannschaftPlus1(m1,m2);}


            CheckBox cb3 = new CheckBox();

            cb3.Name = ("cb3_" + Convert.ToString(lane));

            cb3.Location = new System.Drawing.Point(460, y);

            cb3.Width = 30;

            cb3.Text = "2";

            Controls.Add(cb3);

          //  if (cb1.Checked == true)

          // { mannschaftPlus3(); }

        }

mit den auskommentierten Stellen habe ich einen Versuch gestartet, allerdings prüft er diese bereits beim Erzeugen der CheckBox. Ich brauche jedoch eine Reaktion auf das Aktivieren. Mit dem CheckedChanged-Ereignis sollte es funktionieren allerdings habe ich keine Ahnung wie ich dieses hier einbauen kann.

Ich hoffe ich konnte mein Problem ausreichend darstellen und hoffe auf eure Hilfe.

mfg, Stefan

dankeschön

-closed-

ok doch net closed aber ich habe keinen edit button.

und zwar kann ich im ereignis CheckedChanged die checkbox nicht ansprechen, da ich gerne prüfen würde ob sie aktiviert ist habe ich mir folgendes gedacht:

private void cb1_CheckedChanged(object sender, EventArgs e)

{

if (cb1.Checked == true)

{ mannschaftPlus3(); }

else

MessageBox.Show("OFF");

}

Fehler: cb1 im aktuellen Kontext nicht vorhanden.

Frage: kann ich dem Ereignis irgendwie cb1 als parameter übergeben?

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.