Recently, a netizen asked me this question, I went online search, the result is very disappointed, there are several in the CSDN on the help post, see finally did not find a clear answer. Here I found on the Internet API function SetParent (), and the online error has been modified, and gave a simple example code. Readers can test themselves:
Public Class Form1 ' octopus brother, qq:3107073263 Group: 309816713 ' If you have any questions or good suggestions please contact me, everyone progress together ' declaration setparent function, which is an API function Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hwndchild as INTPTR, ByVal hwndnewparent as INTPTR) as Lo ng Private Sub Form1_Load (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles mybase.load ME.ISMD IContainer = True ' sets Form1 to parent form container End Sub Private Sub button1_click (ByVal sender as System.Object, ByVal e as Syst Em. EventArgs) Handles Button1.Click ' Form1 is the parent form, Form2 is a subform SetParent (Form2.handle, Me.handle) form2.show ( ) End Sub Private Sub button2_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button2. Click SetParent (Form3.handle, Me.handle) form3.show () End subend Class
Effect:
Vb. NET Octopus Brother Production-How to troubleshoot MDI child forms overridden by controls in the parent form