Reputation: 60902
i have the standard code for Program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace cellap
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
when i run the app, i get an error on the mentioned line:
Error 1 The type or namespace name 'Form1' could not be found (are you missing a using directive or an assembly reference?) C:\Users\alexluvsdanielle\AppData\Local\Temporary Projects\cellap\Program.cs 18 33 cellap
does anyone know what the problem is?
Upvotes: 0
Views: 21926
Reputation: 353
using ProjectName.folder
Then create an object for the Form1() class like this.
Form1 form1 = new Form1();
Application.Run(form1);
Also, make sure you actually have a Form1.cs
Upvotes: 1
Reputation: 7937
When you copied the Form did you change it's namespace so the Program.cs can actually see it?
Upvotes: 2
Reputation: 20571
Check your namespace. The existing Form1
is more than likely in a different namespace than cellap
. Check the Form1.designer.cs
class too.
Upvotes: 2