vb.net 获取子窗口的变量值

用CType转成你的窗口类型就可以引用了

比如你的子窗口类是MyForm

单击父窗口Button2显示它包含字符串MyPath的内容的代码如下

Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

MsgBox(CType(Me.ActiveMdiChild, MyForm).MyPath)

End Sub