Add SendTo Iiem to a ContextMenu

ccsdev

Member
Joined
Aug 21, 2009
Messages
5
Programming Experience
Beginner
As a new vb programmer I need some help. I need to add a selction to a custom context menu (right click). The item should act like the SendTo you get when you right click on items in My Computer. I need to get the list of options available on each individual computer. For example the user wants to send a list of files to Drive G (DVD).
Does anyone have code for this?
 
It is not clear from your question what part your problem it is that you require the code for.

If all that you require is a list of the available drives then the easiest method is to use Directory.GetLogicalDrives or Environment.GetLogicalDrives. Both of these return an array of strings containing the names (C:\, D:\ etc.) of the drives available to a particular computer. By iterating over the array you can construct a context menu which you can add to your 'Send To' menu item.
VB.NET:
    mySendToMenuItem.DropDown = myNewDrivesContext

Then it is simply a matter of hooking them up to a click event handler.

You might also consider adding a 'Browse' item to the drivesContext, the handler for which would display a FolderBrowserDialog.
 
Back
Top