Results 1 to 7 of 7

Thread: i have some problem pls help

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    2

    i have some problem pls help

    when i run form from sub Main()
    it'll show and disappear in a second.
    i have created the object of the form
    and use the methon show()
    and it does't work

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You have to hold the thread open so you can either use ShowDialog instead of Show or use Application.Run(formtypehere)

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    Just to clarify Edneeis's response,


    You create the instance of the form in the General section of the Module:

    e.g. Public frmMain As New fclsMain

    and then create the following Sub Main.

    VB Code:
    1. Public Sub Main()
    2.  
    3. Application.Run(frmMain)
    4.  
    5. End Sub
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Just as a note you do not need to declare it in the general section if you don't want you can just assign a new instance in the Application.Run method or just use ShowDialog. Technically you could just call Application.Run() after using Show too, which would hold the thread open but I don't want to confuse you.
    VB Code:
    1. Public Sub Main
    2.  
    3.    'you can do this
    4.    Application.Run(New frmMain)
    5.  
    6.   'or this instead
    7.   Dim frm As New frmMain
    8.   frm.ShowDialog()
    9.  
    10.   'or what taxes showed you
    11.  
    12. End Sub

  5. #5
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi Edneeis,

    " Application.Run(New frmMain)"

    I did not know that one! Looks like this is my day for picking your brains.

    Am I right in saying all three methods will result in the application closing when frm Main is closed, even though other forms were open at that time?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes you are right providing there isn't something that would hold things up after the call to Application.Run or ShowDialog. It's all six in one, half a dozen in the other or different ways to do the samething.

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    2

    Smile

    thanks for the solutions

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