C
C#•2y ago
danny turner

usercontrols not saving data such as button/trackbar values

Hi, im really new to c# and am just trying out a simple program. I have usercontrols in my form but the data does not save and the programs/timers stop working on the one i switched from any help would be appreciated. Here is some code i use to switch between usercontrols:
private void addUserControl(System.Windows.Forms.UserControl userControl)
{
userControl.Dock = DockStyle.Fill;
mainpanel.Controls.Clear();
mainpanel.Controls.Add(userControl);
mainpanel.SendToBack();
userControl.BringToFront();
}
private void addUserControl(System.Windows.Forms.UserControl userControl)
{
userControl.Dock = DockStyle.Fill;
mainpanel.Controls.Clear();
mainpanel.Controls.Add(userControl);
mainpanel.SendToBack();
userControl.BringToFront();
}
private void SettingsButton_Click(object sender, EventArgs e)
{
SettingsButton.FillColor = Color.Silver;
realsettings uc = new realsettings();
addUserControl(uc);
ProgramButton.FillColor = Color.DimGray;
}
private void SettingsButton_Click(object sender, EventArgs e)
{
SettingsButton.FillColor = Color.Silver;
realsettings uc = new realsettings();
addUserControl(uc);
ProgramButton.FillColor = Color.DimGray;
}
1 Reply
danny turner
danny turnerOP•2y ago
just checked the program still runs and the timers are working but the data such as buttons and sliders get reset someone help please 😭 solved
Want results from more Discord servers?
Add your server