Hi HemanthB-9452,
You can save the alarm panel at the same time as the new setting alarm panel appears
I made a simple code example you can refer to.
private void Form1_Load(object sender, EventArgs e)
{
panel1.Visible = false;
}
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible = true;
panel1.BackColor = Color.Gray;
button2.Text = "Save";
panel1.Controls.Add(button2);
}
List<Panel> panels = new List<Panel>();
Panel pl;
private void CreateAlarm()
{
//creat another same alarm panel
Button b2 = new Button();
b2.Text = "Save";
b2.Location = new Point(0, 100);
b2.Click += new EventHandler(b2_Click);
DateTimePicker DateTimePicker = new DateTimePicker();
pl = new Panel();
pl.BackColor = Color.Red;
pl.Visible = true;
this.Controls.Add(pl);
panels.Add(pl);
pl.Controls.Add(b2);
pl.Controls.Add(DateTimePicker);
pl.Size = new Size(203, 234);
pl.Location = new Point(200, 200);
}
private void b2_Click(object sender, EventArgs e)
{
//when the User sets and saves their second alarm the second alarm panel should go and settle next to the previously saved alarms
//Meanwhile,the new alarm setting panel appears
pl.Size = new Size(panel1.Width, panel1.Height);
pl.Location = new Point(panel1.Location.X + (panel1.Width * panels.Count), panel1.Location.Y);
CreateAlarm();
}
private void button2_Click(object sender, EventArgs e)
{
panel1.Location = new Point(0, 0);
panel1.Size = new Size(200, 100);
CreateAlarm();
}
The result:
Best Regards,
Daniel Zhang