CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Apr 2005
    Posts
    20

    Unhappy Form Disappear Automatically

    This is very strange, I have a form, a very simple "Hello World" type of form. If I just do F5, the form shows up, no problem. Now I added a module, with the following code:
    ***********************
    Module MainModule
    Dim frm1 As New frmLogin1()

    Sub Main()
    If PrevInstance() Then
    msg = "This Program is already running. Please shut down the currently running"
    msg = msg & " process before starting a new one"
    MsgBox(msg, vbInformation)
    Exit Sub
    Else
    Startapplication()
    End If
    End Sub

    Function PrevInstance() As Boolean
    If UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
    Return True
    Else
    Return False
    End If
    End Function

    Sub Startapplication()
    frm1.Show()
    End Sub
    End Module
    **********************************

    And I changed the startup object to "sub main" in the project property.

    Now, when I do F5, the frmLogin shows, and then disappear automatically...

    Can anybody tell me what I did wrong? many thanks...
    Last edited by MacArthur; August 8th, 2005 at 04:59 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

Featured