For example, an editor program might open the files and display them. When you do this, the program starts, receiving the full path names of the dragged files as command line parameters.Ī Visual Basic program can use the Command$ function to learn its command line parameters and take appropriate action. One method is to drag objects such as files onto the program’s icon in Windows Explorer or on the desktop.
The following sections explain how to respond when files are dragged onto a program’s icon and when objects are dragged within a single program.ĭrop Start There are many ways to start a program. This article explains two ways you can add drag and drop to your Visual Basic programs. This is not because it is difficult, but because it is poorly understood. While common throughout Windows applications in general, drag and drop is rare in Visual Basic programs. For example, if you drag a text file’s icon from Windows Explorer onto a Notepad shortcut on your desktop, the Notepad program opens and displays the text file. You can drag files to and from Windows Explorer, the desktop, folders, and icons and shortcuts representing other applications. Drag and drop is everywhere in the Windows operating environment.