DesktopApplication.DocumentOpened(item as FolderItem)

DesktopApplication.DocumentOpened(item as FolderItem) showing an error.

What is the error you got ?

invalid syntax

I presume you added it with Add Event Handler…, if so it works for me.

Is it the code inside the event or the event definition?

What is the syntax of using it

As with any event you need to add it correctly. You cannot just add a method called “DesktopApplication.DocumentOpened”. As with any event you click on the object you wish to add to, in this case the App object of your project, and then click the + popup in the lower toolbar:

and choose Event Handler… from the popup menu:

a dialog will open and you can choose the event you want:

Once you have it then the code looks something along the line of this:

Sub DocumentOpened(item As FolderItem) Handles DocumentOpened
  If item <> Nil Then
    ' Process the folderitem as if you had it provided by a file open dialog box...
  End If
End Sub
1 Like