Results 1 to 5 of 5

Thread: *RESOLVED* Load a form from main class

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    The Netherlands
    Posts
    403

    *RESOLVED* Load a form from main class

    I've just started with VB.NET after years of experience in VB 6.0 and I have a little problem.

    I've created a class with a sub main. This routine creates a new form which it does just fine, but after that statement it returns immediatly. In VB 6 it would return if the form was closed. The main difference is that I'm expecting the form to take over control, waiting for events and stuff. Because the call just returns my program finishes closing the window.

    VB Code:
    1. Public Class Bomberman
    2.     Private Shared frmMain As Main
    3.  
    4.     Public Shared Sub Main()
    5.         frmMain = New Main() 'VB 6 would return at the moment the form was closed, VB.NET returns immediatly!
    6.         frmMain.Show()
    7.     End Sub 'because it will return, my app finishes immediatly.
    8. End Class

    I found out by creating a new project with a 'startup form' the form would normally load without exiting immediatly. I wanted to know how it did that so I had a look at it's code. I noticed that there was not a single byte different from my forms code. The difference between the projects is that I have a seperate class with a sub main, creating the form, and the other project starts the form by default. How can I find out how to make my form stay without calling it by default?
    Last edited by Xa0z; Mar 31st, 2004 at 10:56 AM.
    There are 10 types of people, those who understand binary and those who don't

    http://merlijn.beyonix.net

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