---mdi窗体和多窗体编程--- 目的:在mdi窗体内用toolbar实现多窗体的实例,在vb.net中显示窗体一般代码如下 private sub toolbar1_buttonclick()sub toolbar1_buttonclick(byval sender as system.object, byval e as system.windows.forms.toolbarbuttonclickeventargs) handles toolbar1.buttonclick select case e.button.text case "ok" '"ok" is toolbarbutton.text dim fr as new frmname fr.mdiparent = me 'me is mdiform fr.show() end select end sub
http://www.chinaaspx.com/club/topic_5_7796.htm
参考了一下,得出下面的代码
private shared fr as new frmname private sub toolbar1_buttonclick()sub toolbar1_buttonclick(byval sender as system.object, byval e as system.windows.forms.toolbarbuttonclickeventargs) handles toolbar1.buttonclick select case e.button.text case "ok" '"ok" is toolbarbutton.text if fr is nothing or fr.isdisposed then fr = new frmname fr.mdiparent = me fr.show() else fr.mdiparent = me fr.show() fr.focus() end if end select end sub 这样就实例了一次窗体~ ---end---