VB.net通过窗体名称(字符串)来得到窗体的实例_VB.net_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

VB.net通过窗体名称(字符串)来得到窗体的实例

作者:黑客防线网安网站维护基地 来源:黑客防线网安网站维护基地 浏览次数:0

本篇关键词:VBNET

方法一(Reflection):

Dim str As String
str = "myTest.Form2"  '必须是 命名空间+点+窗体类名
Dim tempAssembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
Dim frm2 As Form = CType(tempAssembly.CreateInstance(str), Form)
frm2.Show()

方法二(Type.GetType() ):

Dim frmName, fullName As String
frmName = "form2"
fullName = Application.ProductName & "." & frmName
Dim frm2 As Form
frm2 = Activator.CreateInstance(Type.GetType(fullName, True, True))
frm2 .Visible = True

 

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-269-1.html
网站维护教程更新时间:2008-02-22 03:55:50  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer