sorry for bumping very very old thread, but i'm interest with it.
i assume this would be a browser app because the XML node has link on it ..
using datagridview control, i've managed build menu-like datagridview and simple click handler event but without subitem support ..
but still, i cant figure out how achieve like this with MenuStrip control ..
any help ?
this is my example using DataGridView ;
XML Code ;
Code:
<app>
<menu>
<cat>1</cat>
<title>VBForums</title>
<link>http://www.vbforums.com/</link>
</menu>
<menu>
<cat>1</cat>
<title>Google</title>
<link>http://www.google.com/</link>
</menu>
</app>
Datagridview fill data from xml file code ;
Code:
Dim xFile As XmlReader
xFile = XmlReader.Create("xml-file-path", New XmlReaderSettings)
Dim ds As New DataSet
ds.ReadXml(xFile)
With dgMenu
Dim dv As DataView
'can set filter and sorting
dv = New DataView(ds.Tables("menu"), "cat <> 99", "cat ASC", DataViewRowState.CurrentRows)
.DataSource = dv
'hide the other coloumn, so its like a vertical menu
.Columns(0).Visible = False
.Columns(2).Visible = False
End With
Datagridview click code ;
Code:
Private Sub dgMenu_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgMenu.CellContentDoubleClick
If sender.Rows(e.RowIndex).Cells(2).Value <> "" Then Webbrowser1.Navigate(sender.Rows(e.RowIndex).Cells(2).Value)
End Sub