Adding radiobutton with a button
Posted: Wed Dec 14, 2011 7:38 am
Hi,
I'm new in C# and I have a problem.
I have a screen 1 (called "ecranSave") which contains one button. When I click on this button, it adds radiobuttons.
However, when I change screen and I go back to screen 1, radiobuttons disappear.
This is the sample code I have written :
Where is the problem?
Thanks for your answer (and sorry for my English!!)
Best regards,
antoineA.
I'm new in C# and I have a problem.
I have a screen 1 (called "ecranSave") which contains one button. When I click on this button, it adds radiobuttons.
However, when I change screen and I go back to screen 1, radiobuttons disappear.
This is the sample code I have written :
Code: Select all
public partial class ecranSave
{
public void addProg(string nom, int X, int Y)
{
RadioButton radio = new RadioButton();
radio.BackColor = Color.Transparent;
radio.Text = nom;
radio.Location = new Point(X,Y);
this.Controls.Add(radio);
}
void Button1_Click(System.Object sender, System.EventArgs e)
{
string nom_prog = Globals.Tags.nomProgEnCours.Value;
this.addProg(nom_prog,Globals.Tags.XPositionRadio.Value, Globals.Tags.YPositionRadio.Value + Globals.Tags.nbProg.Value * 20);
Globals.Tags.nbProg.Value ++;
}
}
Thanks for your answer (and sorry for my English!!)
Best regards,
antoineA.