Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Sat Jan 03, 2009 10:38 am Post subject: HOWTO: Open a file with its default application when it is double-clicked |
|
|
To execute the default command on a file when it is double-clicked (typically 'open', which opens the file with its associated application), handle the FolderView.NodeDoubleClick event and use the following code in the event handler:
[C#]
Code: | void folderView_NodeDoubleClick(object sender, FolderViewEventArgs e)
{
if (!e.Node.IsFolder()) // Only execute default command for files
{
e.Node.ExecuteShellCommand(LogicNP.FolderViewControl.ShellCommands.Default);
}
} |
[VB.Net]
Code: | Private Sub fldrView_NodeDoubleClick(ByVal sender As System.Object, ByVal e As LogicNP.FolderViewControl.FolderViewEventArgs) Handles fldrView.NodeDoubleClick
If (e.Node.IsFolder() = False) Then ' Only execute default command for files
e.Node.ExecuteShellCommand(LogicNP.FolderViewControl.ShellCommands.Default)
End If
End Sub |
|
|