changing the main form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jordi Maicas

    changing the main form

    Hello!!

    I've just started a new windows form in C#, but when I finished my Form1, I
    remembered that I would like to add a new form to login to the App.

    So, I need to load first a Form2, and if I login succesfully, show Form1.

    ¿How could I change the App, to load Form2, and not Form1?

    Thanks.


  • Peter Duniho

    #2
    Re: changing the main form

    On Wed, 28 May 2008 14:44:29 -0700, Jordi Maicas
    <jmaycasNOSPAM@ hotmail.comwrot e:
    I've just started a new windows form in C#, but when I finished my
    Form1, I
    remembered that I would like to add a new form to login to the App.
    >
    So, I need to load first a Form2, and if I login succesfully, show Form1.
    >
    ¿How could I change the App, to load Form2, and not Form1?
    Just edit the Main() method in your Program.cs file to suit your needs.

    And rename both your forms so that they have more meaningful names. :)

    Pete

    Comment

    • Duggi

      #3
      Re: changing the main form

      In the Program.cs class there would be Main function something like
      below

      static void Main()
      {
      Application.Ena bleVisualStyles ();
      Application.Set CompatibleTextR enderingDefault (false);
      Application.Run (new Form1());
      }

      Change the Application.Run (new Form1()); line to reflect to the login
      form.... something like

      Application.Run (new LoginForm());


      This should work.

      Thanks
      -Cnu


      On May 29, 2:44 am, "Jordi Maicas" <jmaycasNOS...@ hotmail.comwrot e:
      Hello!!
      >
      I've just started a new windows form in C#, but when I finished my Form1, I
      remembered that I would like to add a new form to login to the App.
      >
      So, I need to load first a Form2, and if I login succesfully, show Form1.
      >
      ¿How could I change the App, to load Form2, and not Form1?
      >
      Thanks.

      Comment

      • Jordi Maicas

        #4
        Re: changing the main form

        I've got the following error:

        Program.cs(18,3 3): error CS0246: The type or namespace name 'Form2' could
        not be found (are you missing a using directive or an assembly reference?)



        And in the Solution Explorer, I see Form2.

        Any ideas?



        "Duggi" <DuggiSrinivasa Rao@gmail.comes cribió en el mensaje
        news:8609144d-95c4-4431-b559-32699bc6904b@56 g2000hsm.google groups.com...
        In the Program.cs class there would be Main function something like
        below

        static void Main()
        {
        Application.Ena bleVisualStyles ();
        Application.Set CompatibleTextR enderingDefault (false);
        Application.Run (new Form1());
        }

        Change the Application.Run (new Form1()); line to reflect to the login
        form.... something like

        Application.Run (new LoginForm());


        This should work.

        Thanks
        -Cnu


        On May 29, 2:44 am, "Jordi Maicas" <jmaycasNOS...@ hotmail.comwrot e:
        Hello!!
        >
        I've just started a new windows form in C#, but when I finished my Form1,
        I
        remembered that I would like to add a new form to login to the App.
        >
        So, I need to load first a Form2, and if I login succesfully, show Form1.
        >
        ¿How could I change the App, to load Form2, and not Form1?
        >
        Thanks.

        Comment

        • Peter Duniho

          #5
          Re: changing the main form

          On Thu, 29 May 2008 14:38:41 -0700, Jordi Maicas
          <jmaycasNOSPAM@ hotmail.comwrot e:
          I've got the following error:
          >
          Program.cs(18,3 3): error CS0246: The type or namespace name 'Form2' could
          not be found (are you missing a using directive or an assembly
          reference?)
          Well...is Form2 in the same namespace as Form1? If not, you need to
          either fully qualify the type name, or include a using directive (just as
          the error tells you).

          It's not really possible with the information given here for any of us to
          explain the exact error with certainty. You may want to consider looking
          more closely at the error and your own code and its structure and see if
          you can figure it out yourself. You'll have a lot of problems down the
          road if you don't get comfortable dealing with basic compile errors like
          this on your own.

          Pete

          Comment

          • Jordi Maicas

            #6
            Re: changing the main form

            I solved.

            Thanks.

            "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.come scribió en el mensaje
            news:op.ubxxj1x 18jd0ej@petes-computer.local. ..
            On Thu, 29 May 2008 14:38:41 -0700, Jordi Maicas
            <jmaycasNOSPAM@ hotmail.comwrot e:
            >
            >I've got the following error:
            >>
            >Program.cs(18, 33): error CS0246: The type or namespace name 'Form2' could
            >not be found (are you missing a using directive or an assembly
            >reference?)
            >
            Well...is Form2 in the same namespace as Form1? If not, you need to
            either fully qualify the type name, or include a using directive (just as
            the error tells you).
            >
            It's not really possible with the information given here for any of us to
            explain the exact error with certainty. You may want to consider looking
            more closely at the error and your own code and its structure and see if
            you can figure it out yourself. You'll have a lot of problems down the
            road if you don't get comfortable dealing with basic compile errors like
            this on your own.
            >
            Pete

            Comment

            Working...