danny turner
danny turner
CC#
Created by danny turner on 6/28/2023 in #help
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;
}
4 replies