Results 1 to 3 of 3

Thread: Loading a form from Main procedure

  1. #1

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Loading a form from Main procedure

    I don't know what the hell is going on here...

    First time I am using a module as the startup...

    VB Code:
    1. Module Module1
    2.     Public Sub Main()
    3.         Dim myform As New Form1()
    4.         myform.Show()
    5.  
    6.     End Sub
    7. End Module

    And for some reason... the form loads... and then prompty disappears... and the program exits...

    why?

  2. #2
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    <removed; was old VB6 code>
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  3. #3
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    That's because the main is terminating.

    You have to redesignate what the application - dependant form is like so:

    VB Code:
    1. Sub Main()
    2.         'your code here
    3.         Dim f1 As New Form1()
    4.         Application.Run(f1)
    5.     End Sub
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

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