Results 1 to 6 of 6

Thread: Multiple instances of a form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Posts
    93

    Multiple instances of a form

    OK, I don't get it.

    I have a main form which is originally loaded via a subMain using Application.Run(New frmMain()) at the start of my app. Button1 on frmMain opens a second form(Form4). On a click event of Form4 I need to close Form4 and go back to frmMain. Currently on the click event of Form4 another instance of frmMain opens because I also placed:

    Dim frmMain As New frmMain()
    frmMain.Show()

    in the click event. I know that's not right & it causes my problem, but how do I get around this? How do I bring up only one instance of frmMain?

    Thanks

  2. #2
    Lively Member Edilson's Avatar
    Join Date
    Aug 2000
    Location
    Orlando
    Posts
    81
    Is frmMain a MDI form ??

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    No it's not

  4. #4
    Addicted Member
    Join Date
    Sep 2003
    Posts
    227
    i dont understand if all you want to do is close the form, i think writing
    Code:
    me.close
    in the click event will do it, why are adding
    Code:
    Dim frmMain As New frmMain()
    frmMain.Show()
    if you just want to close it?!!!


    sorry if i understood your Q wrong ...

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I think persianboy is right, if you close the current form then focus should automatically go back to the previous form. I mean you never closed the main form right? So it'll still be there.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    Thanks persianboy & Edneeis, Thats what I needed to do. I guess that with learning .Net & knowing that simple things are different I sometimes make things harder than they should be.

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