Changing a forms name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I'm changing a forms name in the project and this form is a startup form (set in the project properties), I get an error that the function "sub main" is not found. The visual basic should automaticly change it's name in the project properties as it changes it automaticly in the code window.

Is there any fixes for it?
(I'm using Visual Studio .NET 2003)
 
* =?Utf-8?B?QWxleCBMZXZp?= said:
When I'm changing a forms name in the project and this form is a
startup form (set in the project properties), I get an error that the
function "sub main" is not found. The visual basic should automaticly
change it's name in the project properties as it changes it automaticly
in the code window.

Doubleclick the error. A dialog will popup that lets you select the new
startup form. If it doesn't, go to the project options dialog and set
the startup object there.
 
I know that I can change the startup form manually, but is there a way that it would change automaticly as the code windows does?
 
* =?Utf-8?B?QWxleCBMZXZp?= said:
I know that I can change the startup form manually, but is there a way that it would change automaticly as the code windows does?

I don't think so. But that's a two-clicks task.
 
I know that I can change the startup form manually, but is there a way that
it would change automaticly as the code windows does?

No. You'll have to wait for VS 2005.
 
Hi Alex,

Are you sure you want to change the Name of the class and not only the name
of the form which you can do with me.Text?

And when not, maybe you will tell us what is the reason that you want to
change the name of the Form (the object) and is it when you want to do that
a problem that you have to change the startup Form Class name in the project
properties (The startup form holds internally a Sub Main from the Form class
which it inherit)?

Cor
 
Alex,

Actually I think what you are seeing as a bug is probably intended behavior.
It just isn't the most desirable behavior. Visual Studio does not crash
when you change the name of the startup form, it simply asks you to select a
new startup class.

-Sam Matzen
 
Hi Jeff,

You mean that when I in VS2005 change the name of the by the building of the
project by the wizard created form change, that that new name will be set as
the startup project?

I hope it is not.

By the way, I cannot call it a bug as you do, that when after that the
wizard did its work there is not wizard action anymore.

Cor
 
Hi Alex,

Setting the startup name in the properties is an action from the project
building wizard, that stops working after the first building is done.

That is normal behaviour of every wizard.

Why you call this a bug?

Cor
 
You mean that when I in VS2005 change the name of the by the building of the
project by the wizard created form change, that that new name will be set as
the startup project?

If you create a Windows application you will get the default Form1 and it
will be set as the startup form (form, not project). If you subsequently
change the form's name (say, to frmMain), VS 2005 will change the startup
form to match it so you don't have to manually go into the project
properties and do it like you have to now.

If a different form (or Sub Main) is set as the startup form, nothing will
happen when you rename this form. VS 2005 simply synchronizes your name
change across the project.
By the way, I cannot call it a bug as you do, that when after that the
wizard did its work there is not wizard action anymore.

"Bug" was the original poster's word, not mine.
 
Setting the startup name in the properties is an action from the project
building wizard, that stops working after the first building is done.

That is normal behaviour of every wizard.

Why you call this a bug?

It's more of an oversight. If the project was set for Form1 to be the
startup form and you change Form1's name to frmMain, it's silly for Visual
Studio to still have the startup form set to Form1 when such a form no
longer exists in the project.
 
Hi Jeff,

After overthinking it, I think that understand my misunderstanding, I never
change the class name in the designer. I agree that when you do it that way,
what is probably ment here, it can change the properties as well from the
startup project.

Cor
 
Hi Alex,

I never change the class name using the designer, when you do it that way,
it can as well automaticly be done for the startup project, I agree that
with you, however to call it a bug is something to much, you can call it a
small disadvantage in my opinion.

Cor
 
* =?Utf-8?B?QWxleCBMZXZp?= said:
Mayble, but I'm not deleting a form, just changing it's name.
So VB.NET should change it's name anyware, including in the project properies, like it does in the code window.
If I were deleting the form, then I would agree with you that the user must re-enter a new form as for a startup form.

I agree, it would be nice if that would work. I didn't take a look, but
I assume that this will be done automatically in VB 2005.
 
* "Jeff Johnson said:
It's more of an oversight. If the project was set for Form1 to be the
startup form and you change Form1's name to frmMain, it's silly for Visual
Studio to still have the startup form set to Form1 when such a form no
longer exists in the project.

I agree, if the form is /deleted/, then the user should get prompted for
selecting the startup form. Nevertheless, when simply /renaming/ the
class that is treated as startup form, VB should set the renamed form as
startup form automatically or ask if it should be taken as startup form.
 
* "Cor Ligthert said:
You mean that when I in VS2005 change the name of the by the building of the
project by the wizard created form change, that that new name will be set as
the startup project?

Startup project? Startup form?
I hope it is not.

By the way, I cannot call it a bug as you do, that when after that the
wizard did its work there is not wizard action anymore.

I never used a wizard to create a Windows Forms application, but there
was still a startup form selected automatically.
 
Hi Herfried,

Try in VS IDE File->New->Project than opens a window choose Visual Basic
Projects and than Windows Application. Give the name for your application.

A wizard will than generate a complete project for you. (Such a thing is
called a wizard even if it is not named a wizard)

I understand from you that you use empty project, however I find that to
much work.

:-)

Cor
 
Back
Top