Results 1 to 2 of 2

Thread: Start up with Sub Main()

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Thailand
    Posts
    221

    Start up with Sub Main()

    In VB6, I like to use my application start in Sub Main. I declare all forms in sub main and start my application with frmMain.Show. But in VB.NET I cannot do like this. After I run my application, it was opened and closed immediately. I don't understand why it was like that. Is it good to do this way, I mean declare all forms in module and start with MainForm.Show() in Sub Main()?
    Teeravee Sirinapasawasdee
    Gestalt IT Consulting Group
    Growth Your Business With e-Process

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well its probably not good to do it that way, at least not declaring everything in a module, its a bit wasteful. Only declare things as you need them. Although starting from a Sub Main is fine. You can either show the forms modally to fix your problem or run the main form via the application object:
    VB Code:
    1. 'show modally
    2. frm.ShowDialog()
    3.  
    4. 'use application object
    5. Application.Run(frm)
    6. 'or
    7. Application.Run(New Form1)

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