In meinem Hauptformular habe ich eine Textbox nämlich textBoxTotalTotal
und ich möchte alle dynamisch hinzugefügt Textfeld hinzugefügt/Summe in meinem textBoxTotalTotal
Wie kann ich das erreichen?
In meiner Hauptform habe ich dies: textBoxTotalTotal
Da ist in meinem User Control habe ich dieseFügen Sie dynamisch hinzugefügte Textbox Wert von Benutzersteuerung zu Hauptformular
public void textBoxTranspo_TextChanged(object sender, EventArgs e)
{
int intTranspo = 0, intBoxDaily = 0;
if (int.TryParse(textBoxTranspo.Text, out intTranspo) && int.TryParse(textBoxDaily.Text, out intBoxDaily))
textBoxTotalAmount.Text = (intTranspo + intBoxDaily).ToString();
}
und
public void textBoxDaily_TextChanged(object sender, EventArgs e)
{
int intTranspo = 0, intBoxDaily = 0;
if (int.TryParse(textBoxTranspo.Text, out intTranspo) && int.TryParse(textBoxDaily.Text, out intBoxDaily))
textBoxTotalAmount.Text = (intTranspo + intBoxDaily).ToString();
}
Beachten Sie, dass ich dynamisch, dass die User Control in der per Taste am Hinzufügen Hauptform, wie oft ich mag. Also die textBoxTotalTotal
sollte nur hinzufügen, ob eine neue 2 Textbox auftaucht.
Hallo, wie kann ich feststellen, welche Eltern von UserControl ist? – Noobster
usercontrol.Parent? – TaW