For Each t As ToolStripItem In fobj.MenuStrip1.Items Dim parentnode As TreeNode = TreeView1.Nodes.Add(t.Name, t.Name) GetMenues(t, menues, parentnode, 1) parentnode.Expand() Next Public Sub GetMenues(ByVal Current As ToolStripItem, ByRef menues As List(Of ToolStripItem), ByVal parentnode As TreeNode, ByVal s As Integer) If Not String.Compare(s.ToString, "1") = 0 Then Dim fatherNode As TreeNode = parentnode.Nodes.Add(Current.Name, Current.Name) End If If TypeOf (Current) Is ToolStripMenuItem Then For Each menu As ToolStripItem In DirectCast(Current, ToolStripMenuItem).DropDownItems GetMenues(menu, menues, parentnode, s + 1) Next End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)