I have a snip code to show how a list of events was created.
While tb.MoveNext()
Try
idMenu = tb.Current.Field(Of Integer)("idMenu")
menuName = tb.Current.Field(Of String)("HeaderName")
ClassType = tb.Current?.Field(Of String)("ClassType")
newTreeItem = New TreeViewItem()
Dim clickHandler As New MouseButtonEventHandler(Sub(sender, e)
MessageBox.Show(menuName)
End Sub)
AddHandler TryCast(newTreeItem, TreeViewItem).PreviewMouseDoubleClick, clickHandler
Catch ex As Exception
End Try
End While
In the above code, anything working ok but have a problem is MessageBox.Show
always shows a fixed value at the last of the while loop.
I can't find out how it works. Can you help me with that!