Hello to everyone, I have this code, that gives me an error on the marked
line. It is to make a reference to a submenuitem, to enable it thorgh it
name.
Error line:
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems
error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows .Forms.ToolStri pSeparator' to type
'System.Windows .Forms.ToolStri pMenuItem'."
If anyone knows how to solve this, it would be of great help
Thank you
Manek
Private Sub mkgv2_container _Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.RecorrerEstr ucturaMenu(Me.m en_principal,
mk_sqlre_2("sec _per_cat").ToSt ring)
End Sub
Private Sub RecorrerEstruct uraMenu(ByVal oMenu As MenuStrip, ByVal sOpcion
As String)
For Each oOpcionMenu As ToolStripMenuIt em In oMenu.Items
If oOpcionMenu.Dro pDownItems.Coun t > 0 Then
Me.RecorrerSubm enu(oOpcionMenu .DropDownItems, sOpcion)
End If
Next
End Sub
Private Sub RecorrerSubmenu (ByVal oSubmenuItems As ToolStripItemCo llection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems 'ERROR
LINE'|||||||||| ||||||||||||||| |
If oSubitem.Name = sOpcion Then
oSubitem.Enable d = True
End If
If oSubitem.DropDo wnItems.Count > 0 Then
Me.RecorrerSubm enu(oSubitem.Dr opDownItems, sOpcion)
End If
Next
End Sub
line. It is to make a reference to a submenuitem, to enable it thorgh it
name.
Error line:
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems
error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows .Forms.ToolStri pSeparator' to type
'System.Windows .Forms.ToolStri pMenuItem'."
If anyone knows how to solve this, it would be of great help
Thank you
Manek
Private Sub mkgv2_container _Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.RecorrerEstr ucturaMenu(Me.m en_principal,
mk_sqlre_2("sec _per_cat").ToSt ring)
End Sub
Private Sub RecorrerEstruct uraMenu(ByVal oMenu As MenuStrip, ByVal sOpcion
As String)
For Each oOpcionMenu As ToolStripMenuIt em In oMenu.Items
If oOpcionMenu.Dro pDownItems.Coun t > 0 Then
Me.RecorrerSubm enu(oOpcionMenu .DropDownItems, sOpcion)
End If
Next
End Sub
Private Sub RecorrerSubmenu (ByVal oSubmenuItems As ToolStripItemCo llection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems 'ERROR
LINE'|||||||||| ||||||||||||||| |
If oSubitem.Name = sOpcion Then
oSubitem.Enable d = True
End If
If oSubitem.DropDo wnItems.Count > 0 Then
Me.RecorrerSubm enu(oSubitem.Dr opDownItems, sOpcion)
End If
Next
End Sub
Comment