Controlling the Opening and Closing of Forms in Windows Apllication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mai Moon
    New Member
    • Jan 2012
    • 2

    Controlling the Opening and Closing of Forms in Windows Apllication

    I need an urgent help,I have a startup form for loading my application,the n after the load(closing that form),another 2 forms are opened :Main Application Form and Login Form,The Login Form appears as modal form,so as to the user must login or register first then the main application form appears,This surely after closing the login form.What happens is both of these 2 forms are still opened in the background and also the startup form appears as notification for the current running program.I tried a lot of methods such as:Close(),Disp ose(),Hide() ,but with no use.This problem repeates with all other forms.So,What can I do in details ,please?????Tha nks I Advance.
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    Why don't you show the code that's causing this issue as we're not mind readers :)

    Comment

    • Mai Moon
      New Member
      • Jan 2012
      • 2

      #3
      private void Form1_Load(obje ct sender, EventArgs e)
      {
      timer1.Enabled = true;
      timer1_Tick(pro gressBar1, e);
      }


      int min, max;
      private void timer1_Tick(obj ect sender, EventArgs e)
      {
      // timer1.Start();
      timer1.Enabled = true;
      progressBar1.Mi nimum = 0;
      progressBar1.Ma ximum = 10000;
      min = progressBar1.Mi nimum;
      max = progressBar1.Ma ximum;


      for (int i = progressBar1.Mi nimum; i <= progressBar1.Ma ximum; i++)
      {

      progressBar1.In crement(1);
      progressBar1.Va lue=i;
      // progressBar1.Pe rformStep();
      }

      if (progressBar1.V alue == max)
      {

      timer1.Enabled = false;
      // MessageBox.Show ("The form is already opened");
      this.Show();

      ManagementForm manage = new ManagementForm( );
      manage.Show();
      LoginForm login = new LoginForm();
      login.ShowDialo g();
      this.Close();
      this.Dispose();



      }



      }

      Comment

      Working...