Reputation: 1830
Actually i'm trying to show and dialog into a parent form, An reference example is:
Parent Parent_child dialog
Main_form new_invoice new_invoicedialog
I Tryed this code But it says:
Private Sub invoice_new_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
With new_invoicedialog
.MdiParent = Main_Form
.Owner = Me 'invoice_new
.StartPosition = FormStartPosition.CenterScreen
.ShowDialog()
End With
End Sub
Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog.
Upvotes: 0
Views: 7797
Reputation: 1
I know this is real late but it might prove helpful to someone else that may come across this as I did when researching this issue. You could do smt like:
newTransaction.MdiParent = Me
Me.Enabled = False
newTransaction.Show()
Me.Enabled = True
It allows you to still run the forma as a child but turns off the parent form until the child is closed, then it makes it available again.
Upvotes: 0
Reputation: 5747
I think if you remove .MdiParent = Main_Form
it will work. You're trying to show a modal dialog, which isn't the same thing as an MDI form.
Upvotes: 3