Brother some days ago to do projects, the first use of vb.net, met a lot of problems, I believe that many beginners will encounter these problems, in order to learn the convenience of beginners, younger brother summed up some small experience for everyone to refer to the discussion.
First: How to control the properties of a parent form in an MDI child form and so on
Features: For example, when you open a subform, you set a menu item or button in the parent form to be invisible, and so on.
Content:
The MDI parent form and MDI child form classes are defined as follows:
MDI parent form:
Class MDIForm
Inherits System.Windows.Forms.Form
.........
' Member Mnumain
Friend WithEvents Mnueditpaste as System.Windows.Forms.MenuItem
.......
' Member
Friend WithEvents Toolscan as System.Windows.Forms.ToolBarButton
Private Sub Showchild ()
Dim frmtmp As New mdichildfom ' Define a new instantce of Mdichildform
Frmtmp.mdiparent = Me ' Set the new form to be a mdichild
Frmtmp.show () ' Show the ' new form
End Sub
End Class
MDI child form:
Class Mdichildform
.......
' Set Mnueditpaste & Toolscan cannot be seen
Private Sub Setmdimnutoolunvisible ()
'***************************************'
' Can set a MenuItem to be unvisible '
'***************************************'
' This method is could not control one MenuItem
' Can only set a group of MenuItems
Me. MdiParent.Menu.Menuitems (0). Visible = False ' Set the ' the ' MenuItem can not is seen
' With the ' method ' for you have ' modify Toolscan
Dim frmmdi As MDIForm
If tyhpeof me. MdiParent is MDIForm
frmMDI = DirectCast (me. MdiParent, MDIForm) ' Get the instantce of me. MdiParent
' Then you should access all members of class MDIForm without private members
Frmmdi.mnueditpaste = False
Frmmdi.toolscan = Flase
' Like this and could do everything with MDIForm for you want
End If
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.