0
I am trying to open a form within another form, but I am having a certain difficulty.
The idea is that when the clicked on the button "btn_CadastroAlunos" the form "F_cadastro_alunos.Vb" is opened in the Panel1 that is present in the main form "F_principal.Vb"
My code is like this in the Button Click event ("btn_CadastroAlunos"):
Dim NovoForm As New F_Cadastro_Alunos
NovoForm.TopLevel = False
NovoForm.Visible = True
Panel1.Controls.Add(NovoForm)
NovoForm.Show()
But when executing the button click operation, the following error is returned:
System.Argumentexception: 'Only top-level controls can have an owner. Arg_paramname_name'
The following image explains a little better the error generated when trying to display the form:
Does anyone know the solution?! Thank you for your attention!
Note: I am using the framework: Moden UI