Results 1 to 11 of 11

Thread: [RESOLVED] A startup form has not been specified

  1. #1

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    Resolved [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?

  2. #2
    Hyperactive Member Skatebone's Avatar
    Join Date
    Jan 2009
    Location
    Malta
    Posts
    279

    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.
    Life runs on code

  3. #3

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    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.

  4. #4
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: A startup form has not been specified

    Quote Originally Posted by BrianPaul View Post
    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.

  5. #5

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    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?

  6. #6

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    Re: A startup form has not been specified

    I'm using 2005, not 2008.

  7. #7
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    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.

  8. #8
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    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."

  9. #9

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    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'.

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: A startup form has not been specified

    Do you have a Main method in your module?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11

    Thread Starter
    Hyperactive Member BrianPaul's Avatar
    Join Date
    Aug 2007
    Posts
    294

    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
  •  



Click Here to Expand Forum to Full Width