Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

VS 2010 Adding context menu items

$
0
0
I have a context menu (mnuContext) created at design-time and I want to modify one entry at runtime. I can't see an obvious way to modify an entry so deleting and adding will be fine. I must be doing something daft as I can't get this to work:
Code:

    Dim ContextImageProperites As New ToolStripMenuItem
    ContextImageProperites.Text = "Image Properties..."
    ContextImageProperites.Tag = "10"
    AddHandler ContextImageProperties.Click, AddressOf ContextImageProperties_Click
    mnuContext.Items.Add(ContextImageProperites)
    ...

    Private Sub ContextImageProperties_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("Clicked Image Properties!")
    End Sub

The error is 'ContextImageProperties' is not declared' on the AddHandler line, which seems odd as it's defined as a ToolStripMenuItem. What am I doing wrong?

Viewing all articles
Browse latest Browse all 42220

Trending Articles