|
-
May 12th, 2009, 10:44 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] A startup form has not been specified
I have a VB.net program that originally had a form. I added a module and then deleted the form, but now I get the error...
"A startup form has not been specified"
With VB6 I would change the startup object to sub main, but I can't see how to do this in the properties of the project. I tried changing the application type to console, but then I get the following error...
No accessible 'Main' method with an appropriate signature was found in 'WindowsApplication1'
How can I do this without using the original form?
-
May 12th, 2009, 10:47 AM
#2
Hyperactive Member
Re: A startup form has not been specified
You want to run a module without an application?
Thats impossible :/
You can double click on "my project" to view all project properties and startup form.
-
May 12th, 2009, 10:57 AM
#3
Thread Starter
Hyperactive Member
Re: A startup form has not been specified
Hmm... with VB6 you could have an app without a form. I guess what I need to do is have a form, but not show it. In that case, how would I have the form not show and how would I have the code start executing? Right now it's a command button that starts the execution.
-
May 12th, 2009, 10:58 AM
#4
Re: A startup form has not been specified
 Originally Posted by BrianPaul
I have a VB.net program that originally had a form. I added a module and then deleted the form, but now I get the error...
"A startup form has not been specified"
With VB6 I would change the startup object to sub main, but I can't see how to do this in the properties of the project. I tried changing the application type to console, but then I get the following error...
No accessible 'Main' method with an appropriate signature was found in 'WindowsApplication1'
How can I do this without using the original form?
Interesting question - I hit exactly the same issue the other day - I'm sure that in .Net I've also done the same thing but possibly in 2005 or earlier.
I don't know if its something that has disappeared in 2008.
You can put your startup code in the my.application.startup event but I was surprised to find the sub Main option missing.
Last edited by keystone_paul; May 12th, 2009 at 11:02 AM.
-
May 12th, 2009, 10:58 AM
#5
Thread Starter
Hyperactive Member
Re: A startup form has not been specified
Oh wait, you said "module without an application". I do want it to be an application. How do I go about making the application work with a module instead of a form?
-
May 12th, 2009, 11:00 AM
#6
Thread Starter
Hyperactive Member
Re: A startup form has not been specified
I'm using 2005, not 2008.
-
May 12th, 2009, 11:06 AM
#7
Re: A startup form has not been specified
Researching a bit it seems the same applies to 2005 so I must have been thinking 2003.
To access the my.application.startup event you go to Project Properties and select the application tab and click the "View Application Events" button and it opens a new module containing a partial class MyApplication which has a number of events including Startup. That would allow you to effectively do what you would previously have done in a sub Main.
If you don't want to have any forms at all then why not create a console application instead of a forms application?
Last edited by keystone_paul; May 12th, 2009 at 11:21 AM.
-
May 12th, 2009, 01:53 PM
#8
Re: A startup form has not been specified
You need to uncheck 'Enable Application Framework' on the My Project/Application tab. You can then select the Sub Main entry point to the application (Startup Object).
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
May 12th, 2009, 09:10 PM
#9
Thread Starter
Hyperactive Member
Re: A startup form has not been specified
I did uncheck 'Enable Application Framework' and I set the startup object to 'Sub Main', but I still get this error when I try to run the program...
No accessible 'Main' method with an appropriate signature was found in 'WindowsApplication1'.
-
May 12th, 2009, 10:04 PM
#10
Re: A startup form has not been specified
Do you have a Main method in your module?
-
May 12th, 2009, 10:37 PM
#11
Thread Starter
Hyperactive Member
Re: A startup form has not been specified
Ok, got it. I had copied my command click sub from the form and forgot to remove some arguments. I needed to change...
Sub main(ByVal sender As System.Object, ByVal e As System.EventArgs)
to...
Sub main()
Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|