Gets the Form that contains this control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
'Declaration <UIPermissionAttribute(SecurityAction.Demand, Window := UIPermissionWindow.AllWindows)> _ Public Function GetForm As Form
The following code example uses the method to determine if a MainMenu is currently parented to the form. If the call in the example code to does not return Nothing, the code then clones the menu structure of the MainMenu using the CloneMenu method. The code then sets the RightToLeft property to true on the new copy of the MainMenu to create a MainMenu that can be used for languages that support right to left text. This example requires that you have a MainMenu created that is named mainMenu1.
Public Sub CloneMyMenu() ' Determine if mainMenu1 is currently hosted on the form. If (mainMenu1.GetForm() IsNot Nothing) Then ' Create a copy of the MainMenu that is hosted on the form. Dim mainMenu2 As MainMenu = mainMenu1.CloneMenu() ' Set the RightToLeft property for mainMenu2. mainMenu2.RightToLeft = RightToLeft.Yes End If End Sub
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.