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 think this is usefull, a lot of the users have problems with .Net Framework installation,
Error code: HRESULT 0xc8000222
Do these to solve:
a: Click Start > ...
There are a number of very old threads on CUDA so I'm starting a new one rather than resurrecting an old one.
Does anyone here have any experience setting up ...
ive been develop a project known as ordering system
i need to delete data from db by clicking the button
ive follow a tutorial from utube and to the exact ...