I'm trying to dynamically add a menuitem to my context menu and add a click handler but for some reason it won't add the handler what did a do wrong?
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click For Each Line In RichTextBox1.Lines Dim NewItem As New MenuItem NewItem.Text = Line AddHandler NewItem.Click, AddressOf NewItem_Click ContextMenuStrip1.Items.Add(Line) Next End Sub Private Sub NewItem_Click(sender As Object, e As EventArgs) MsgBox(CType(sender, MenuItem).Text) End Sub
Dim NewItem As ToolStripMenuItem = New ToolStripMenuItem NewItem.Text = Line AddHandler NewItem.Click, AddressOf NewItem_Click ContextMenuStrip1.Items.Add(NewItem)
Edited by tinstaafl
maybe try firts to debug your codes to see what is the problem.
I want to draw a triangle using mouse events like mousePressed(), mouseReleased() and mouseDragged(). But triangle did not show until mouse release. Please tell me what i am ...
what i have done is copied answer in label and now matching the radiobutton option with it so far so good but i dont know how to uncheck radio button ...
Is there anyone know how to read a text file line by line from the web/internet in VC++?
I have a function which works well in reading the ...