how to add toolstripitem to the top of contextmenustrip? RRS feed

  • Question

  • Hi,folks

    I have successfully create toolstripitems dynamically, but if I add them to the contextmenustrip, they are added at the bottom of the strip. My question is how to add to the top of the strip instead? I couldn't find any information on the net.

    dim item1 as toolstripMenuItem
    item1= New ToolStripMenuItem("1")

    Your help is greatly appreciated.

    Monday, May 11, 2009 1:48 AM


  • use Insert and you can specify an Index. So to add at the top specify Index of 0

    Dim item1 As ToolStripMenuItem
            Dim item2 As ToolStripMenuItem
            Dim item3 As ToolStripMenuItem
            item1 = New ToolStripMenuItem("Here")
            item2 = New ToolStripMenuItem("There")
            item3 = New ToolStripMenuItem("Everywhere")
            ContextMenuStrip1.Items.Insert(0, item3)
    • Edited by jwavila Monday, May 11, 2009 6:25 AM edit
    • Marked as answer by Tigerwood2006 Monday, May 11, 2009 6:37 AM
    Monday, May 11, 2009 6:05 AM