Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How do I fix this error?

How do I fix this error?

Scheduled Pinned Locked Moved C#
helpquestiongame-dev
15 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Angelinna

    How do I fix this error which says "The namespace 'Game' already contains a definition for 'Form1'" What does it mean and how do I fix it. It resulted after I wrote this; public class Form1: System.Windows.Forms.Form Thanks.

    P Offline
    P Offline
    Paul Conrad
    wrote on last edited by
    #2

    Angelinna wrote:

    how do I fix it.

    Try naming your forms something descriptive when you create them, rather than the default VS throws at you :|

    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

    A 1 Reply Last reply
    0
    • P Paul Conrad

      Angelinna wrote:

      how do I fix it.

      Try naming your forms something descriptive when you create them, rather than the default VS throws at you :|

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

      A Offline
      A Offline
      Angelinna
      wrote on last edited by
      #3

      Tried to.Still not fixed. When I put a descriptive name, it tell me that namespace with that descriptive name already contains a definition for that name .

      S J 2 Replies Last reply
      0
      • A Angelinna

        Tried to.Still not fixed. When I put a descriptive name, it tell me that namespace with that descriptive name already contains a definition for that name .

        S Offline
        S Offline
        Simon P Stevens
        wrote on last edited by
        #4

        You've got two forms with the same name. Rename the forms, not the namespace (If this isn't working, post the code where you declare the namespace and form so we can see what is happening)

        Simon

        1 Reply Last reply
        0
        • A Angelinna

          Tried to.Still not fixed. When I put a descriptive name, it tell me that namespace with that descriptive name already contains a definition for that name .

          J Offline
          J Offline
          J a a n s
          wrote on last edited by
          #5

          Angelinna wrote:

          Tried to.Still not fixed.

          By any chance did you remove the partial keyword?

          *jaans

          S A 2 Replies Last reply
          0
          • J J a a n s

            Angelinna wrote:

            Tried to.Still not fixed.

            By any chance did you remove the partial keyword?

            *jaans

            S Offline
            S Offline
            Simon P Stevens
            wrote on last edited by
            #6

            Good idea.

            Simon

            1 Reply Last reply
            0
            • J J a a n s

              Angelinna wrote:

              Tried to.Still not fixed.

              By any chance did you remove the partial keyword?

              *jaans

              A Offline
              A Offline
              Angelinna
              wrote on last edited by
              #7

              Yes. I removed it earlier on.

              C A 2 Replies Last reply
              0
              • A Angelinna

                Yes. I removed it earlier on.

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #8

                Angelinna wrote:

                Yes. I removed it earlier on.

                Why?

                Recent blog posts: *Method hiding Vs. overriding *Microsoft Surface *SQL Server / Visual Studio install order My Blog

                1 Reply Last reply
                0
                • A Angelinna

                  Yes. I removed it earlier on.

                  A Offline
                  A Offline
                  Ashfield
                  wrote on last edited by
                  #9

                  Well, put it back and see if that works with your rename of the form etc.

                  Bob Ashfield Consultants Ltd

                  A 1 Reply Last reply
                  0
                  • A Ashfield

                    Well, put it back and see if that works with your rename of the form etc.

                    Bob Ashfield Consultants Ltd

                    A Offline
                    A Offline
                    Angelinna
                    wrote on last edited by
                    #10

                    sorted.Thanks.

                    modified on Saturday, October 18, 2008 5:21 AM

                    S 1 Reply Last reply
                    0
                    • A Angelinna

                      sorted.Thanks.

                      modified on Saturday, October 18, 2008 5:21 AM

                      S Offline
                      S Offline
                      Simon P Stevens
                      wrote on last edited by
                      #11

                      Asside from the fact that you are missing several close brackets '}', which I'm assuming are just because you didn't copy and paste them. You need to put the word 'partial' back into your code. You can't just go removing word without understanding what they mean. The main declaration of the from should be

                      public partial class Form1 : Form

                      The declaration in the Designer.cs file should be

                      partial class Form1

                      Simon

                      A 1 Reply Last reply
                      0
                      • S Simon P Stevens

                        Asside from the fact that you are missing several close brackets '}', which I'm assuming are just because you didn't copy and paste them. You need to put the word 'partial' back into your code. You can't just go removing word without understanding what they mean. The main declaration of the from should be

                        public partial class Form1 : Form

                        The declaration in the Designer.cs file should be

                        partial class Form1

                        Simon

                        A Offline
                        A Offline
                        Angelinna
                        wrote on last edited by
                        #12

                        When I do that correction, it then tell me that Error The type 'TictacGame.Form1' already contains a definition for 'Startbutton' and the same for all the buttons shown in the code in my previous message. Why is that?

                        S 1 Reply Last reply
                        0
                        • A Angelinna

                          When I do that correction, it then tell me that Error The type 'TictacGame.Form1' already contains a definition for 'Startbutton' and the same for all the buttons shown in the code in my previous message. Why is that?

                          S Offline
                          S Offline
                          Simon P Stevens
                          wrote on last edited by
                          #13

                          Angelinna wrote:

                          Error The type 'TictacGame.Form1' already contains a definition for 'Startbutton'

                          Because you've probably declared them twice. Just a quick suggestion. Don't go messing with the code in the Designer.cs file. That's how you've got yourself into this mess. Stick to just using the GUI.

                          Simon

                          P 1 Reply Last reply
                          0
                          • A Angelinna

                            How do I fix this error which says "The namespace 'Game' already contains a definition for 'Form1'" What does it mean and how do I fix it. It resulted after I wrote this; public class Form1: System.Windows.Forms.Form Thanks.

                            H Offline
                            H Offline
                            Hesham Yassin
                            wrote on last edited by
                            #14

                            try to change the input parameters of the Constructor

                            1 Reply Last reply
                            0
                            • S Simon P Stevens

                              Angelinna wrote:

                              Error The type 'TictacGame.Form1' already contains a definition for 'Startbutton'

                              Because you've probably declared them twice. Just a quick suggestion. Don't go messing with the code in the Designer.cs file. That's how you've got yourself into this mess. Stick to just using the GUI.

                              Simon

                              P Offline
                              P Offline
                              Paul Conrad
                              wrote on last edited by
                              #15

                              Simon Stevens wrote:

                              Don't go messing with the code in the Designer.cs file.

                              I tell my students that all the time, and yet, when they have some sort of mess up, that is the root cause.

                              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups