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. The type or namespace name 'Form' could not be found (are you missing a using directive or an assembly reference?)

The type or namespace name 'Form' could not be found (are you missing a using directive or an assembly reference?)

Scheduled Pinned Locked Moved C#
15 Posts 4 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.
  • M Member 12244972

    Ok, that fixed that... Now the errors are:

    The type 'System.ComponentModel.IComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    The type 'System.ComponentModel.ISynchronizeInvoke' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    The type 'System.ComponentModel.Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    Only thing is I'm using Visual studio 2012 ultimate. I can't seem to find the assemblies in: Project > Add Reference > Framework Any ideas?

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #4

    Member 12244972 wrote:

    I can't seem to find the assemblies in:

    The system assembly would already be in the references, if you created the project using VS. Are you mixing .NET framework versions? What .NET version is the DLL targetting that you created?

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

    M 1 Reply Last reply
    0
    • M Member 12244972

      Ok, that fixed that... Now the errors are:

      The type 'System.ComponentModel.IComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

      The type 'System.ComponentModel.ISynchronizeInvoke' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

      The type 'System.ComponentModel.Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

      Only thing is I'm using Visual studio 2012 ultimate. I can't seem to find the assemblies in: Project > Add Reference > Framework Any ideas?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #5

      Did you create a Console application by mistake? This is all setup for you already if you pick the Windows Forms Application project type.

      A guide to posting questions on CodeProject

      Click this: Asking questions is a skill. Seriously, do it.
      Dave Kreskowiak

      M 1 Reply Last reply
      0
      • L Lost User

        Member 12244972 wrote:

        I can't seem to find the assemblies in:

        The system assembly would already be in the references, if you created the project using VS. Are you mixing .NET framework versions? What .NET version is the DLL targetting that you created?

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        M Offline
        M Offline
        Member 12244972
        wrote on last edited by
        #6

        Ok, I understand your point. The dll was targetting .net v2.0 and the program .net v4.6.1 I rebuilt the dll targetting .net v4.6.1 Still the same issue after restarting the Visual studio.

        The type 'System.ComponentModel.IComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

        The type 'System.ComponentModel.ISynchronizeInvoke' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

        The type 'System.ComponentModel.Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

        Any ideas?

        L P 2 Replies Last reply
        0
        • M Member 12244972

          Ok, I understand your point. The dll was targetting .net v2.0 and the program .net v4.6.1 I rebuilt the dll targetting .net v4.6.1 Still the same issue after restarting the Visual studio.

          The type 'System.ComponentModel.IComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

          The type 'System.ComponentModel.ISynchronizeInvoke' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

          The type 'System.ComponentModel.Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

          Any ideas?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #7

          Member 12244972 wrote:

          The dll was targetting .net v2.0 and the program .net v4.6.1

          Should work, might have problems if it was the other way around. Only thing I can think of, is that you might be targetting the wrong CPU-type; if the DLL is compiled for 64 bits, and the app is targetting 32 bits, or the other way around.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          1 Reply Last reply
          0
          • M Member 12244972

            Ok, I understand your point. The dll was targetting .net v2.0 and the program .net v4.6.1 I rebuilt the dll targetting .net v4.6.1 Still the same issue after restarting the Visual studio.

            The type 'System.ComponentModel.IComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

            The type 'System.ComponentModel.ISynchronizeInvoke' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

            The type 'System.ComponentModel.Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

            Any ideas?

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #8

            Open up the csproj file in a text editor and look for this line:

            <Reference Include="System" />

            If the line isn't there, include it alongside your other references.

            This space for rent

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              Did you create a Console application by mistake? This is all setup for you already if you pick the Windows Forms Application project type.

              A guide to posting questions on CodeProject

              Click this: Asking questions is a skill. Seriously, do it.
              Dave Kreskowiak

              M Offline
              M Offline
              Member 12244972
              wrote on last edited by
              #9

              Ok, created a new project for Windows form. The recurring error now is:

              Invalid token '(' in class, struct, or interface member declaration

              In the code:

              namespace Siren
              {
              static class Program
              {
              public partial class Form1 : Form
              {
              IDictionary _libs = new Dictionary();

                  // yada yada yada...
              
              	int absW, absX, absY, absZ;
                          
                  // Your inputs here
                  Console.Write("\\nPlease input parameter 1 of first set... ");// Error occurs here...
                  absW = Console.ReadLine();
               }
              

              }
              static void Main()
              {
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              Application.Run(new Form1());
              }
              }

              D 1 Reply Last reply
              0
              • M Member 12244972

                Ok, created a new project for Windows form. The recurring error now is:

                Invalid token '(' in class, struct, or interface member declaration

                In the code:

                namespace Siren
                {
                static class Program
                {
                public partial class Form1 : Form
                {
                IDictionary _libs = new Dictionary();

                    // yada yada yada...
                
                	int absW, absX, absY, absZ;
                            
                    // Your inputs here
                    Console.Write("\\nPlease input parameter 1 of first set... ");// Error occurs here...
                    absW = Console.ReadLine();
                 }
                

                }
                static void Main()
                {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
                }
                }

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #10

                The Console doesn't exist in a Windows Forms app. Also, this looks like you're putting Console code into a Windows Forms project now, where before you where trying to use Windows Forms code in something other than a Windows Forms project. So, which is it supposed to be? What are you really doing?

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                M L 2 Replies Last reply
                0
                • D Dave Kreskowiak

                  The Console doesn't exist in a Windows Forms app. Also, this looks like you're putting Console code into a Windows Forms project now, where before you where trying to use Windows Forms code in something other than a Windows Forms project. So, which is it supposed to be? What are you really doing?

                  A guide to posting questions on CodeProject

                  Click this: Asking questions is a skill. Seriously, do it.
                  Dave Kreskowiak

                  M Offline
                  M Offline
                  Member 12244972
                  wrote on last edited by
                  #11

                  I'm being impatient because I expected to be done with this today. But since that is not going to happen, I'll stop cobbling things together and recode with fresh eyes tomorrow. Thanks for the help. Will get back to you.

                  1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    The Console doesn't exist in a Windows Forms app. Also, this looks like you're putting Console code into a Windows Forms project now, where before you where trying to use Windows Forms code in something other than a Windows Forms project. So, which is it supposed to be? What are you really doing?

                    A guide to posting questions on CodeProject

                    Click this: Asking questions is a skill. Seriously, do it.
                    Dave Kreskowiak

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #12

                    Dave Kreskowiak wrote:

                    The Console doesn't exist in a Windows Forms app.

                    Ehr.. stdout still exists in a WinForm. It is just a console-app that hides its console and puts up a GUI.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                    D 1 Reply Last reply
                    0
                    • L Lost User

                      Dave Kreskowiak wrote:

                      The Console doesn't exist in a Windows Forms app.

                      Ehr.. stdout still exists in a WinForm. It is just a console-app that hides its console and puts up a GUI.

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #13

                      Yes, it does but the the purpose of this guys apparent homework, no it doesn't.

                      A guide to posting questions on CodeProject

                      Click this: Asking questions is a skill. Seriously, do it.
                      Dave Kreskowiak

                      L 1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        Yes, it does but the the purpose of this guys apparent homework, no it doesn't.

                        A guide to posting questions on CodeProject

                        Click this: Asking questions is a skill. Seriously, do it.
                        Dave Kreskowiak

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #14

                        Homework is a strict assignment in order to learn a specific subject or topic. This does not look like homework.

                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                        D 1 Reply Last reply
                        0
                        • L Lost User

                          Homework is a strict assignment in order to learn a specific subject or topic. This does not look like homework.

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                          D Offline
                          D Offline
                          Dave Kreskowiak
                          wrote on last edited by
                          #15

                          Whoops. My bad. I got this one confused with another thread.

                          A guide to posting questions on CodeProject

                          Click this: Asking questions is a skill. Seriously, do it.
                          Dave Kreskowiak

                          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