4/3/2023 0 Comments File drag and drop vb6![]() ![]() In fact you can use any control on the form instead. ![]() ![]() In the code above, I showed dropping files on to the form. If you drag more than one files, it will open the first file (for demonstration). Drag any file from your desktop or Windows Explorer on to this form. ” lets open the first file to demonstrate that we know what was dropped. ” when the file is dropped on the form, we get the filename from it.ĭim files() As String = CType (e.Data.GetData(DataFormats.FileDrop), String ()) Private Sub Form1_DragDrop( ByVal sender As Object, _ If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then ” we change the mouse icon to signal the user that it can be dropped there. Private Sub Form1_DragEnter( ByVal sender As Object, _īyVal e As ) _ Private Sub Form1_Load( ByVal sender As System.Object, _ Start a new VB.NET forms application and add the following code to the form: And selecting any item in the listbox should show the image in the picturebox. ![]() Image files can be dragged and dropped into the listbox. All we need to do is set the AllowDrop property of the control to True and then trap the appropriate Drag events.įor our first demo we will drop any file from windows explorer into the form, and let the form open that file for us.įor our second demo, we will add a listbox and picturebox to our form. To drop a file into your form and make your form accept it is quite easy. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |