[Solved] The type namespace name Form1 could not be found


If the line you mentioned, System.Windows.Forms.Application.Run(new Form1()); is in a file in a different namespace to xpartygo, you’ll need to edit it to System.Windows.Forms.Application.Run(new xpartygo.Form1()); to sort the namespaces.

Alternatively, place the file with the above line into the same namespace.

In future, pasting the exact error message as output from the compiler, along with any code it references, makes life a lot easier for people wanting to help – which makes life easier for you 🙂

Just in case it’s a lack of understanding of namespaces that’s the issue, see here for more info.

Edit in response to comment:
Cool, we all start somewhere – class A can only “see” class B if they’re either in the same namespace, or class A has a using statement referencing this namespace that class B lives in.

It’s like a folder structure, you can only see files/classes in the directory/namespace you’re currently in, unless you look up/using another folder/namespace.

A class’ namespace is defined by the namespace foo { ... } block it’s inside. The link above should explain all this in more detail than I can.

Your problem is likely that you have two classes in different namespaces, and one’s trying to access the other. Unless you deal with this properly, by “looking up” the appropriate namespace, you’ll get the compilation error you saw.

3

solved The type namespace name Form1 could not be found