Reputation: 770
I'm a new c# user, while creating Win-App I got error and I search here on Stackoverflow but couldn't fix my problem. I looked at Type or namespace could not be found 'Form1'
Error 1 The type or namespace name 'Form1' could not be found
Code:
namespace WindowsApplication3
{
public partial class Form1 : Form
{
System.Net.Sockets.TcpClient clientSocket = new System.Net.Sockets.TcpClient();
public Form1()
{
InitializeComponent();
}
1. I tried to rename my Form1 to something else but it gives me the same error.
2. I checked all the references and they seem to be in order.
Upvotes: 1
Views: 1631
Reputation: 109792
I suspect a namespace error.
Is the Form in a namespace called WindowsApplication3
and the Program class in a namespace called WindowsFormsApplication3
by any chance?
Ensure you are using the same namespace for both, or alternatively add a using
to Program.cs to specify the correct namespace.
Upvotes: 4