Results 1 to 9 of 9

Thread: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    64

    Cool In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Under Project Application Properties it gives you the option to select Startup Form but no option to say use VB Module Subroutine instead?
    You could do this in VB6, any ideas guys? I'm new to VB.NET.

    Or is it that your vb.net applications have to start of in a Form?

    Thanks
    Rag

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Turn off the Enable Application Framework.... then create a sub New in your module. Then you'll be able to select it as the start up point.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    64

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Thats great thanks mate

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

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    That is generally a bad idea. There really are very few legitimate reasons to have to do that. In almost all cases you should leave the application framework enabled, leave your startup object as a form and simply handle the Startup event of the application. That event is raised BEFORE the startup form is created, so that's where you can, and should, do any processing that needs to be done prior to the main form being created. An example may be having the user log in. You display a login dialogue from the Startup event handler. If the login is successful you do nothing and the app starts normally. If the login fails then you set e.Cancel to True and the app will exit gracefully without ever creating the startup form.
    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

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    I agree with John.

    The application startup event is for all intensive purposes the same thing as a sub main.

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

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Quote Originally Posted by kleinma
    I agree with John.

    The application startup event is for all intensive purposes the same thing as a sub main.
    Yes, for all intents and purposes it is.
    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

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Sorry my fingers work about 1.8x the speed of my brain on most days

    English is my second language.. VB is my first

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

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Quote Originally Posted by kleinma
    English is my second language.. VB is my first
    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

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    64

    Re: In VB.NET 2005 how do u specify Module Subroutine as Application startup routine?

    Thanks for the additional info..

    More in this article:

    http://visualbasic.about.com/od/usin...nRoutine01.htm

    Was wondering why form.show from my module subroutine would now open the form for long. Article explains it.

    Thanks for raising the point regarding the use of app events
    Last edited by ragstta; Jan 30th, 2007 at 06:38 PM.

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