C
C#7mo ago
buildy1

UserControl issue - UC2 doesn't appear after closing UC1

Hello, I started learning about almost a week ago and the past day or two this problem has been bugging me so much. I may have made it more of a mess than it already is, I tried searching on google and came across a solution that offers constructors but it didn't work out for me. I honestly feel like this has such an easy answer so I am sorry for any inconvenience Could this be a thing that requires Events? Basically, I am making an Address Book project; I want the starting menu to hide and the main menu to show when the user pressed the "Enter" button. The issue is, upon pressing Enter, the start menu does hide but main menu does not show at all. Code of Main Form; (mainMenu.cs is empty except for a this.Hide() at MainMenu())
public Form1()
{
InitializeComponent();
}
public StartMenu startMenu;
public MainMenu mainMenu;
private void Form1_Load(object sender, EventArgs e)
{
Controls.Add(startMenu);
Controls.Add(mainMenu);
}
private void StartMenu_Load(object sender, EventArgs e)
{

}
private void organizerUC(object sender, EventArgs e) // method to connect both UCs
{
if (!startMenu.Visible)
{
mainMenu.Visible = true;
}
public Form1()
{
InitializeComponent();
}
public StartMenu startMenu;
public MainMenu mainMenu;
private void Form1_Load(object sender, EventArgs e)
{
Controls.Add(startMenu);
Controls.Add(mainMenu);
}
private void StartMenu_Load(object sender, EventArgs e)
{

}
private void organizerUC(object sender, EventArgs e) // method to connect both UCs
{
if (!startMenu.Visible)
{
mainMenu.Visible = true;
}
_Code of StartMenu;
public partial class StartMenu : UserControl
{
public StartMenu()
{
InitializeComponent();
this.Show();
}
private void StartMenu_Load(object sender, EventArgs e)
{
Controls.Add(button1);
}
private void button1_Click(object sender, EventArgs e) // enter button
{
this.Hide();
}
}
public partial class StartMenu : UserControl
{
public StartMenu()
{
InitializeComponent();
this.Show();
}
private void StartMenu_Load(object sender, EventArgs e)
{
Controls.Add(button1);
}
private void button1_Click(object sender, EventArgs e) // enter button
{
this.Hide();
}
}
No description
0 Replies
No replies yetBe the first to reply to this messageJoin