"Form1" name unwanted

  • Thread starter Thread starter Tim923
  • Start date Start date
T

Tim923

I rename "Form1.cs" on the right to the desired name, and also go into
properties of the form and name it in the (name) section. After
building, Form1.cs appears in the code and gives an error. I was told
not to double-click anything, but it still happened. How to fix?
 
Tim923 said:
I rename "Form1.cs" on the right to the desired name, and also go into
properties of the form and name it in the (name) section. After
building, Form1.cs appears in the code and gives an error. I was told
not to double-click anything, but it still happened. How to fix?
That would be in void main?
Just change it to whatever you renamed form1 to.

Cheers
JB
 
That would be in void main?
Just change it to whatever you renamed form1 to.

Wow, fast response.

Is there a way to rename "Form1" without having to change code (like I
have been doing), or is "Form1" in the code as soon as the user starts
a new project?

I thought the .cs file name and the name in the (name) section in form
properties should match, but need they?
 
Tim923 said:
Wow, fast response.

Is there a way to rename "Form1" without having to change code (like I
have been doing), or is "Form1" in the code as soon as the user starts
a new project?

I thought the .cs file name and the name in the (name) section in form
properties should match, but need they?

the .cs file can be named whatever you want and doesnt have to
correspond to the name in the project (doesnt matter in code)

As soon as you start a winforms app, it adds form1 and sets that as the
startup form.
You can set the startup object using
project properties >> general >> startup object
but that doesnt seem to rename the main so I dont know what that
actually does.

You should only need to do this for the first form and it shouldnt be a
problem.

Cheers
JB
 
Hello, Tim923!

I faced that problem before, and what I did was just delete the old
form from the project (perhaps from the disk, as you don't need it,
the project manager "on the right" can do it for you) and create a
new one with the desired name...

Hope that helps.

You wrote on Mon, 13 Sep 2004 23:46:55 GMT:

T> I rename "Form1.cs" on the right to the desired name, and also go into
T> properties of the form and name it in the (name) section. After
T> building, Form1.cs appears in the code and gives an error. I was told
T> not to double-click anything, but it still happened. How to fix?

With best regards, Nurchi BECHED.
 
Back
Top