dim frmYouWant as form1 dim clsForm as collection dim intindex as long for intindex=1 to formcount set clsForm=clsForm.add,,"F" & intindex,"formcaption" ..... next intindex clsForm.show
类似的窗体做成通用的,使用New来调用,不通用的就没有办法了 使如 dim theForm1 as new Form1
自己看vb的help阿,那里面不是有例子么! 最好搞个类模块阿!
看我的:For Each ob In frm_guide.Controls If TypeOf ob Is TextBox Then If ob.Text = "" And ob.name <> "txt_acc" Then MsgBox ob.ToolTipText & "不能为空", vbInformation, "信息" ValidCheck = False Exit Function End If End If if .... end
如果可以的话,可以封装成DLL。
用的时候引进来用就是了。
dim clsForm as collection
dim intindex as long
for intindex=1 to formcount
set clsForm=clsForm.add,,"F" & intindex,"formcaption"
.....
next intindex
clsForm.show
使如 dim theForm1 as new Form1
最好搞个类模块阿!
If TypeOf ob Is TextBox Then
If ob.Text = "" And ob.name <> "txt_acc" Then
MsgBox ob.ToolTipText & "不能为空", vbInformation, "信息"
ValidCheck = False
Exit Function
End If
End If if ....
end
if ....
end Next ob