I am completely lost here. I have dynamically created a menuitem. I've added an onclick-event handler, but this code never seems to fire. I remember it working a few months back and don't recall making any changes to it, but it's possibly something stupid that I've done.
Please see my code below:
frmMain._mnuSep1_0.Visible = True
Dim tlRecentApp As New ToolStripMenuItem(strMenuCaption)
tlRecentApp.Text = "Test"
tlRecentApp.Name = "AddApp"
tlRecentApp.Tag = strMenuID
RecentAppID = strMenuID
AddHandler tlRecentApp.Click, AddressOf Test
frmMain.mnuApplicantS.DropDownItems.Add(tlRecentApp.ToString)
The code for the Event:
Public Sub MnuRecentApp(ByVal sender As Object, ByVal e As EventArgs)
' MsgBox(sender.tag.ToString)
ApplicantID = sender.tag.ToString
frmApplicantEdit.Show()
End Sub
It gets created but when I click on it nothing happens:
I found the problem. This line:
Should read: