Hallo,
ich habe ein Problem ich möchte die Werte mehrerer Textboxen in eine vorgefertigte Liste schreiben aber wenn ich dann von der Ursprungsklasse die werte kontrolliere sind sie immer noch so wie vorher. Ich hoffe ihr könnt mir helfen!
Hier der Code:
MfG
PS: Ich bin noch ein Anfänger
ich habe ein Problem ich möchte die Werte mehrerer Textboxen in eine vorgefertigte Liste schreiben aber wenn ich dann von der Ursprungsklasse die werte kontrolliere sind sie immer noch so wie vorher. Ich hoffe ihr könnt mir helfen!
Hier der Code:
Code:
public void button1_Click(object sender, EventArgs e)
{
Form1 Hauptform = new Form1();
for (int i = 0; i < Hauptform.BedürfnisListe.Count; i++)
{
foreach (Control c in this.Controls)
{
if (c.GetType().Name.ToString() == "TextBox")
{
if (c.Name == Hauptform.BedürfnisListe[i].Name)
{
if (c.Text != string.Empty)
{
Hauptform.BedürfnisListe[i].Bonus = Convert.ToInt32(c.Text);
}
break;
}
}
}
}
this.Close();
}
MfG
PS: Ich bin noch ein Anfänger