hi im currently working on a grade book tool for teachers im a beginner im trying to just simply have the user click the button on the current page there on to open an existing window that ive already created this is the code i use
private void PROFILE_Click(object sender, EventArgs e)
{
this.Hide();
ACADEMIC_PROFILE ACADEMIC_PROFILE_SCREEN = new ACADEMIC_PROFILE();
ACADEMIC_PROFILE_SCREEN.Show();
}
my teacher says this is a problem and i need to use:
public partial class ACADEMIC_PROFILE : Form
{
public VIEW_PROFILE VIEW_PROFILE_SCREEN;
public ADD_PROFILE ADD_PROFILE_SCREEN;
public MODIFY_PROFILE MODIFY_PROFILE_SCREEN;
public DELETE_PROFILE DELETE_PROFILE_SCREEN;
public WELCOME_SCREENcs WELCOME_SCREEN_SCREEN;
public ACADEMIC_PROFILE()
{
InitializeComponent();
}
private void VIEW_PROFILE_Click(object sender, EventArgs e)
{
this.Hide();
// If the panel has not created or has been disposed, create one
if ((null == VIEW_PROFILE_SCREEN) || (VIEW_PROFILE_SCREEN.IsDisposed))
{
VIEW_PROFILE_SCREEN = new VIEW_PROFILE();
}
// Open the window
VIEW_PROFILE_SCREEN.WindowState = FormWindowState.Maximized;
VIEW_PROFILE_SCREEN.Show();
}
but when i use this i get new windows instead of opening an existing one it always creates a new form can anyone help me to hide previous windows that where created without using this.hide();