Drag & drop folder work on any Window 10 control?

I want to drag and drop a folder on a textfield and display the path in the textfield. This works perfectly in MacOS. Doesn’t work in Windows 10. I could drag to some other control so tried using a Canvas. I did check that the IDE has Windows Security Privileges set to User.

Fixed. Changed me.AcceptFileDrop(“text”) to me.AcceptFileDrop(“???”) [four question marks]

If it’s OK for you…

But the documentation states:
image

AcceptFileDrop(FileType As String)

Permits documents of type FileType to be dropped on the control. FileType must be a file type that you defined in via the FileType class or the File Type Sets Editor.

Alternatively, you can use a FileType:

Var txtType As New FileType
txtTypeName = "text/raw"
txtType.Extensions = "txt"

or

Var htmlType As New FileType
htmlType.Name = "text/html"
htmlType.Extensions = "htm;html"

and so on for csv, json, etc.

And you can combine two or more in me.AcceptFileDrop()

Using “???” allows your users to drop an image file.

Doh ! You says you want to drop a folder… you have to find the correct name (“os/folder” ?) and test if nothing as extension works.

If you add a FileTypeGroup, drop a Folder from the Finder to fill the properties. This advice comes from Greg.

Here lies the documentation (for FileType, but not only

The following code (from another forum post) in DragEnter event ensures that only a folder item is accepted.

If Not obj.FolderItem.IsFolder Then Return True

That is good ! I forgot about it.

But the UI feedback is different: with “???” the OS inform you the drop is allowed. If you set valid file extension / file type, the OS inform you (with a No Drop) the drop is not possible.

The trick line (below) allows you to exclude dealing with the droped object. But the object HAVE BEEN ACCEPTED.

If Not obj.FolderItem.IsFolder Then Return True