Your code looks fine until these 2 lines.
“MsgBox” is now (since API 2) called “MessageBox”.
Also, MessageDialog is a class made for advanced dialogs (you can customise buttons, the icon, etc), and MsgBox is a another call for a simple dialog.
You don’t have to create a MessageDialog object in order to show a MessageBox: just put MessageBox “My message” and Xojo handles creating the dialog under the hood. Only if you want to actually use a MessageDialog (not MessageBox), should you use the “Dim msgbox2 As New MessageDialog” line.
Now, you’re mainly wasting a MessageDialog object; that should do nothing bad except creating an unused object in memory. So why does it not work?
When you say “it does not work”, we don’t know what you tried and what you’re getting (a compile-time error? A crash?).
Your code would be called if you added the corresponding AcceptFileDrop call earlier. Did you do that? Does your event gets called at all? (put a breakpoint at the “if” line to check for that).