samedi 18 avril 2015

how to build a method to get the component on the inherited form from the base form vb.net

I Have a base form with the following code:



Sub New()
InitializeComponent()
Me.InitRibbonPageGroups()
End Sub

Sub InitRibbonPageGroups()

Dim Ribbon As RibbonControl = Nothing

For Each c As Object In Me.Controls
If Not TryCast(c, WCLib.ClsCompMyRibbonControl) Is Nothing Then
Ribbon = c
Exit For
End If
Next
If Not Ribbon Is Nothing Then
For Each P As RibbonPage In Ribbon.Pages
For Each RPG As WCLib.ClsCompMyRibbonPageGroup In P.Groups
RPG.Visible = RPG.InitialVisibility
Next
Next
End If

End Sub


My problem is that on the base form the component "RibbonControl" does not exist it will exists only on the Form who Inherits from the base. So when this method runs he dont find any control on the me.controls.


My question is if are there any way to achieve this task, I couldn't find an identifier to replace the "Me." one to get the control from the base.


Aucun commentaire:

Enregistrer un commentaire