Hallo, bin am verzweifeln. Suche seit 2 tagen eine möglichkeit textboxen dynamisch zu überprüfen, inhalt löschen, inhalt ersetzen.
mein code ist voll mit solchen riesigen blöcken von textBox aufzählungen.
habe 38 textboxen. muss noch um die 200 textboxen hinzufügen.
wie ich textboxen dynamisch hinzufüge weiß ich.
Schreibe ein Formular-Programm und mir ist nichts besseres eingefallen.
gibt es sowas wie:
Code:
foreach (string i in liste)
{
if (i.Contains("="))
{
Tabelle = i.Split('=');
if (textBox1.Text == Tabelle[0]) textBox20.Text = Tabelle[1];
if (textBox2.Text == Tabelle[0]) textBox21.Text = Tabelle[1];
if (textBox3.Text == Tabelle[0]) textBox22.Text = Tabelle[1];
if (textBox4.Text == Tabelle[0]) textBox23.Text = Tabelle[1];
if (textBox5.Text == Tabelle[0]) textBox24.Text = Tabelle[1];
if (textBox6.Text == Tabelle[0]) textBox25.Text = Tabelle[1];
if (textBox7.Text == Tabelle[0]) textBox26.Text = Tabelle[1];
if (textBox8.Text == Tabelle[0]) textBox27.Text = Tabelle[1];
if (textBox9.Text == Tabelle[0]) textBox28.Text = Tabelle[1];
if (textBox10.Text == Tabelle[0]) textBox29.Text = Tabelle[1];
if (textBox11.Text == Tabelle[0]) textBox30.Text = Tabelle[1];
if (textBox12.Text == Tabelle[0]) textBox31.Text = Tabelle[1];
if (textBox13.Text == Tabelle[0]) textBox32.Text = Tabelle[1];
if (textBox14.Text == Tabelle[0]) textBox33.Text = Tabelle[1];
if (textBox15.Text == Tabelle[0]) textBox34.Text = Tabelle[1];
if (textBox16.Text == Tabelle[0]) textBox35.Text = Tabelle[1];
if (textBox17.Text == Tabelle[0]) textBox36.Text = Tabelle[1];
if (textBox18.Text == Tabelle[0]) textBox37.Text = Tabelle[1];
if (textBox19.Text == Tabelle[0]) textBox38.Text = Tabelle[1];
mein code ist voll mit solchen riesigen blöcken von textBox aufzählungen.
habe 38 textboxen. muss noch um die 200 textboxen hinzufügen.
wie ich textboxen dynamisch hinzufüge weiß ich.
Schreibe ein Formular-Programm und mir ist nichts besseres eingefallen.
gibt es sowas wie:
Code:
for (int i=1;i<=200;i++)
{
(variable)"ArrayList"[i].Clear();
oder
(variable)textBox[i].Text = "Hallo Welt";
}