dcsimg
Results 1 to 4 of 4

Thread: Form on another form

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    13

    Resolved Form on another form

    If I have my main window open and I open another form on top of that, to prevent the form from underneath being touched I used to use for example
    Code:
    Form10.ShowDialog(Me)
    but now I can't seem to use that, what do I use now?
    Last edited by GeGeek; Jan 15th, 2018 at 09:17 AM.

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,464

    Re: Form on another form

    ShowDialog() is correct its just your way of using it thats wrong.

    What you should be doing is in the Main Form calling your pop-up form like this - (assuming the name of you second form is FrmPopup)

    Code:
    Dim frm As New FrmPopup
    frm.ShowDialog()
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,050

    Re: Form on another form

    You can still use that same code in most cases. That said, specifying an owner for a modal dialogue is rather pointless. Are you doing it just because or does it offer some advantage that I'm not able to fathom right now? Also, you will only be able to use the default instance of a form class if it has a default instance, which will not be the case if it has no parameterless constructor. I would tend to recommend that people not use default instances at all but I'd also recommend that they understand what a default instance is and why they would or wouldn't use one.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    13

    Re: Form on another form

    Wait a sec, this is now my own fault after realizing the major boo boo I have done, here is me thinking why is none of this working, then takes a closer look at the vb form, its not vb its cs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width