请教用变量名调用窗体的方法,谢谢!!!
有一窗体aaa(aaa.name="aaa")以打开,但不是当前窗体,我想通过窗体的名称("aaa")来激活它。求教,谢谢!!!
Private Sub ToolStripButton1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ToolStripButton1.MouseDown Call GetFormByName(hdct)‘hdct为全局变量 End Sub Function GetFormByName(ByVal FormName As String) As Form Try CType(Activator.CreateInstance(Type.GetType(Application.ProductName & "." & FormName, True, True)), Form).Show()’这句能打开窗体,但好像为一个新窗体,而不是aaa的激活。求教,谢谢!!! Catch ex As Exception MsgBox(ex.Message) End Try End Function