Just trying to start out simple with Drop Object. Read what I could online but haven’t been able to make it work.
So, when a users drags a file onto a Bevel Button, I want to a message box the native path to the file.
Here’s what I’ve got in the Open EvenHandler for the BevelButton
[code]dim msifile as new filetype
msifile.Extensions = “msi”
me.AcceptFileDrop FileType(msifile)[/code]
And here’s what I have the the Drop Object Event Handler
[code]if obj.FolderItemAvailable then
dim f as FolderItem = obj.FolderItem
dim path as String = f.NativePath
MsgBox path
end[/code]
Not only does that message box not come up, but I get a the circle with the line through it on the drag, showing it’s not accepting the file. And yes, the file ends with .msi extension.
meaning that you get the exact effect you are seeing
your file type variable needs to exist somewhere else that it will not get cleaned up at the end of the open event
like as a property on the window itself
Do you have a FileType Set in the project item list? If not, add one as Emile said earlier. In the FileType Set, set up an entry with the name ‘MSI’, the Display Name ‘MSI’, and the extension ‘.msi’ (don’t forget the dot if you are on Windows).
In the Open event for the Bevelbutton, add the code
Me.AcceptFileDrop ("MSI")
Your code in the DropObject event should be okay.
[code]if obj.FolderItemAvailable then
dim f as FolderItem = obj.FolderItem
So, when you say “Name” MSI, do you mean the text field under name, or the ID name off to the right? Depending on which one I name MSI, I get two very different error.
If the text field name is set to MSI, I get am “Item does not exist” error for “Me.AcceptFileDrop (“MSI”)”
If the ID name is set to MSI I get "CREATE.BevelButton1.Open, line 2
Expected a value of type No Type, but found a static namespace reference to No Type.
me.AcceptFileDrop FileType(MSI)
"
[quote=474871:@Dale Arends]Do you have a FileType Set in the project item list? If not, add one as Emile said earlier. In the FileType Set, set up an entry with the name ‘MSI’, the Display Name ‘MSI’, and the extension ‘.msi’ (don’t forget the dot if you are on Windows).
In the Open event for the Bevelbutton, add the code
Me.AcceptFileDrop ("MSI")
Your code in the DropObject event should be okay.
[code]if obj.FolderItemAvailable then
dim f as FolderItem = obj.FolderItem
dim path as String = f.NativePath
MsgBox path
end[/code][/quote]
I got it. Bad typing on my part. Your example worked.