Autor Beitrag
Talemantros
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 444
Erhaltene Danke: 2

Win7 Proff 64bit
C# (VS2013)
BeitragVerfasst: Mi 31.12.14 15:01 
Hallo,
würde gern Comboboxen durchlaufen um deren Inhalt abzufragen.

Leider klappt dies nicht

Soweit bin ich

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
            foreach (Control control in kryptonGroupBox2.Controls)
            {
                if (control is ComboBox)
                {
                    MsgBox.MsgAusgabe.ShowInformation(((ComboBox)control).Text);
                }
            }


Hat da jemand eine Idee für mich?

Danke

Und guten Rutsch euch allen nachher
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4700
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Mi 31.12.14 16:19 
Sind deine Controls den auch Combobox(en)? Oder etwas anderes (z.B. von Krypton) das nur so aussieht wie eine ComboBox.
Liegen die direkt auf dem kryptonGroupBox2 Control? Wenn nicht und da sind noch Container Controls dazwischen musst du die rekursiv durchlaufen.
Talemantros Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 444
Erhaltene Danke: 2

Win7 Proff 64bit
C# (VS2013)
BeitragVerfasst: Fr 02.01.15 11:33 
Hallo Ralf,
danke für den Tipp mit dem dem KryptonCombobox und dem Rekursiv.

Habe es jetzt wie folgt lauffähig und kann damit weiter arbeiten:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
        private void btnOktabiner_Click(object sender, EventArgs e)
        {
            ReadControls(this);
        }

        private void ReadControls(Control form)
        {
            foreach (Control control in form.Controls)
            {
                if ((control is KryptonComboBox) && (control.Text != string.Empty))
                {
                    MsgBox.MsgAusgabe.ShowInformation(((KryptonComboBox)control).Text);
                }
                else
                    ReadControls(control);
            }
        }