M
Manekurt
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 ToolStripMenuItem In oSubmenuItems
error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows.Forms.ToolStripSeparator' to type
'System.Windows.Forms.ToolStripMenuItem'."
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.EventArgs) Handles MyBase.Load
Me.RecorrerEstructuraMenu(Me.men_principal,
mk_sqlre_2("sec_per_cat").ToString)
End Sub
Private Sub RecorrerEstructuraMenu(ByVal oMenu As MenuStrip, ByVal sOpcion
As String)
For Each oOpcionMenu As ToolStripMenuItem In oMenu.Items
If oOpcionMenu.DropDownItems.Count > 0 Then
Me.RecorrerSubmenu(oOpcionMenu.DropDownItems, sOpcion)
End If
Next
End Sub
Private Sub RecorrerSubmenu(ByVal oSubmenuItems As ToolStripItemCollection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuItem In oSubmenuItems 'ERROR
LINE'||||||||||||||||||||||||||
If oSubitem.Name = sOpcion Then
oSubitem.Enabled = True
End If
If oSubitem.DropDownItems.Count > 0 Then
Me.RecorrerSubmenu(oSubitem.DropDownItems, 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 ToolStripMenuItem In oSubmenuItems
error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows.Forms.ToolStripSeparator' to type
'System.Windows.Forms.ToolStripMenuItem'."
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.EventArgs) Handles MyBase.Load
Me.RecorrerEstructuraMenu(Me.men_principal,
mk_sqlre_2("sec_per_cat").ToString)
End Sub
Private Sub RecorrerEstructuraMenu(ByVal oMenu As MenuStrip, ByVal sOpcion
As String)
For Each oOpcionMenu As ToolStripMenuItem In oMenu.Items
If oOpcionMenu.DropDownItems.Count > 0 Then
Me.RecorrerSubmenu(oOpcionMenu.DropDownItems, sOpcion)
End If
Next
End Sub
Private Sub RecorrerSubmenu(ByVal oSubmenuItems As ToolStripItemCollection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuItem In oSubmenuItems 'ERROR
LINE'||||||||||||||||||||||||||
If oSubitem.Name = sOpcion Then
oSubitem.Enabled = True
End If
If oSubitem.DropDownItems.Count > 0 Then
Me.RecorrerSubmenu(oSubitem.DropDownItems, sOpcion)
End If
Next
End Sub