Results 1 to 5 of 5

Thread: MDI - ShowDialog alternative ***Resolved***

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Phoenx, AZ
    Posts
    15

    MDI - ShowDialog alternative ***Resolved***

    I have a MDI form that opens a child form (called form1). On this form I want to be able to open another form (Called form2). (Which is also a child form). Once the new form is opened I want the code execution to halt for form1 until form2 is closed. The showdialog function does this but it cannot be done from a child form. Is there any way around this?

    The reason I want to do this is so that when form2 comes up i can enter data and then when form2 is closed I can call a method to refresh a combo box on my form1.

    Any help will be much appreciated.
    Last edited by LIPAE; Dec 24th, 2003 at 03:48 PM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Maybe try posting your code because it works fine for me.
    VB Code:
    1. 'in mdi form to show first child
    2.        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3.         Dim frm As New Form2
    4.         frm.MdiParent = Me
    5.         frm.Show()
    6.     End Sub
    7.  
    8.    'in that child to show modal child
    9.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    10.         Dim f As New Form2
    11.         f.ShowDialog()
    12.     End Sub

    Or did you post in the wrong forums? I believe you couldn't do this in VB6 and it looks like most of your other posts were in VB6.
    Last edited by Edneeis; Dec 24th, 2003 at 02:33 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Phoenx, AZ
    Posts
    15
    Nope, I'm working in .net

    Dim frmIndustry As New AddEditIndustry
    frmIndustry.MdiParent = Me.MdiParent.ActiveForm
    frmIndustry.ShowDialog

    Me = frmCompany (Also a child form).
    frmcompany is a child form of a form called Main (mdi form).

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If you want to show it modally then it can't be a MDI child, but why would it need to be? Although it can be shown from an MDI Child. Just remove the line that makes it an MDI child.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Location
    Phoenx, AZ
    Posts
    15
    Yeah I guess I really don't need to make that form a child because it will always stay on top with showdialog method.
    Thanks mucho for the help.

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