当我尝试遍历所有MenuStrip时,我不知道如何进行迭代 使用MenuStrip之类的控件
这里是代码
Public Sub FindAllChildren(ByRef StartingContainer As System.Windows.Forms.Control.ControlCollection)
For Each child As Control In StartingContainer
'MsgBox(child.Name)
If (child.GetType() Is GetType(MenuStrip)) Then
soonmenustrip(child.Container)
Else
MsgBox(child.Name)
End If
If child.HasChildren Then
FindAllChildren(child.Controls)
End If
Next
End Sub
Public Sub soonmenustrip(ByRef StartingContainer As MenuStrip)
For Each t As ToolStripItem In StartingContainer.Items
MsgBox(t.Name)
Next
End Sub
发给我错误 错误1“项目”不是“System.Windows.Forms.Control”
的成员