String testString = "Button"; // String in der Textbox
// UserControls
PictureBox ctl1 = new PictureBox();
Button ctl2 = new Button();
Label ctl3 = new Label();
// Neue ControlCollection
ControlCollection ctls = new ControlCollection(new Form());
ctls.Add(ctl1);
ctls.Add(ctl2);
ctls.Add(ctl3);
// Checkroutine
String ctlName = "";
foreach (Control ctl in ctls)
{
ctlName = ctl.GetType().Name;
if (ctlName == testString)
{
ctl.Height = panel1.Height;
ctl.Width = panel1.Width;
panel1.Controls.Add(ctl);
}
}
// Checkroutine
String ctlName = "";
foreach (Control ctl in ctls)
{
ctlName = ctl.GetType().Name;
if (ctlName == testString)
{
[COLOR=#ff0000] // Eigenschaft des Controls holen
PropertyInfo pi = ctl.GetType().GetProperty("Text");
// Neuen Wert setzen
pi.SetValue(ctl, "Testme", null);[/COLOR]
ctl.Height = panel1.Height;
ctl.Width = panel1.Width;
panel1.Controls.Add(ctl);
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?