Results 1 to 2 of 2

Thread: ContextMenuStrip Sub-Items not working correctly.....

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    ContextMenuStrip Sub-Items not working correctly.....

    I have a context menu strip associated with a listview. Everything work just fine however one of my menu options on the context menu strip has a pop-out menu (you know, you hover over the selection, and another menu strip expands out).

    My issue is, I can seem to get these to work correctly. Here my code:

    Code:
      Public Sub ReleasedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReleasedToolStripMenuItem.Click
            FileEntries(ListViewSelectedIndex).Status = "Released"
            UpdateForm()
            ReleasedToolStripMenuItem.
        End Sub
        Public Sub PendingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReleasedToolStripMenuItem.Click
            FileEntries(ListViewSelectedIndex).Status = "Pending"
            UpdateForm()
        End Sub
        Public Sub ReservedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReleasedToolStripMenuItem.Click
            FileEntries(ListViewSelectedIndex).Status = "Reserved"
            UpdateForm()
        End Sub
        Public Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
            PendingToolStripMenuItem.Checked = False
            ReservedToolStripMenuItem.Checked = False
            ReleasedToolStripMenuItem.Checked = False
            Select Case FileEntries(ListViewSelectedIndex).Status
                Case "Pending"
                    PendingToolStripMenuItem.Checked = True
                Case "Released"
                    ReleasedToolStripMenuItem.Checked = True
                Case "Reserved"
                    ReservedToolStripMenuItem.Checked = True
            End Select
        End Sub
    There is a main context menu, and when you hover over "Change Status" a sub-context menu opens with "Pending", "Released", and "Reserved"

    Now when I select the "Release" it works as expected. Any other selection does nothing.

    Also, when editing the form, I double click the "Release" menu item, it will take me to the code for that button, work fine. The others take me to a new sub, something like:
    Code:
    Public Sub ReservedToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReleasedToolStripMenuItem.Click
            
        End Sub
    So I changed my sub to read as the one VB created, and still didnt work. So I went back to edit the context menu, double clicked "Reserved" menu items, then VB creates a sub w/o the _1 (like I had before).

    Also the check-box status for these menu items works fine.

    Anyone know whats going on here?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: ContextMenuStrip Sub-Items not working correctly.....

    I am an idiot. Helps if I look at my own code, and dont Copy/Paste things. Sorry for wasting time.

    Mod, could you please delete this thread? Thank-you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width