Quantcast
Viewing all articles
Browse latest Browse all 27072

VS 2008 Drag And Drop From A Toolstrip dropdown Item

What i am trying to do is drag the text (or create the impression of a drag) from a dynamically created toolstrip menu item and then place a button on the form at the point
where the user releases the mouse key to complete the drag.
I have the following code, But there is no effect when you try and drag an item, nothing happens

This function is called to insert the menu items

Private Function InsertMenuItem(ByVal MainMenuHeader As String, ByVal SubMenuName As String)

Dim NewItem As New System.Windows.Forms.ToolStripMenuItem

NewItem.Name = "Mnu" & SubMenuName
NewItem.Size = New System.Drawing.Size(152, 22)
NewItem.Text = SubMenuName
NewItem.DoDragDrop(NewItem.Name, DragDropEffects.Move)

Me.TsbAuthorise.DropDownItems.Add(NewItem)


AddHandler NewItem.Click, AddressOf UserHasSelectedAMenuItem
AddHandler NewItem.DragLeave, AddressOf UserHasDraggedAMenuItem

End Function

Private Sub UserHasDraggedAMenuItem(ByVal sender As System.Object, ByVal e As System.EventArgs)

With DirectCast(sender, ToolStripMenuItem)

MsgBox(.Text)

End With

Viewing all articles
Browse latest Browse all 27072

Trending Articles