åbne filer i default prg i Win. Forms "Webbrowser"..i en fildialo
Hej gutterJeg har brugt 2 nætter på det hér, så mit spgmål kort:
Jeg har brugt Windows Form skabelonen Explorer1 til at sætte en browser op- så godt. Men hvordan f.. får jeg fx. under "Proces.. den første Menustrip.. en filedialogbox/listbox til at blive aktiveret af et click og åbne det pågældende prg i default. Har luret lidt på eksempel her fra siden men uden held.
'den søvnløse'
code:
'Webbrower code under Windows Forms/VB2005 Exp.
Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SaveAsToolStripMenuItem.Click
Dim SaveFileDialog As New SaveFileDialog
SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
SaveFileDialog.Filter = "Text Files (*.txt)|*.txt"
SaveFileDialog.ShowDialog(Me)
Dim FileName As String = SaveFileDialog.FileName
' TODO: Add code here to save the current contents of the form to a file.
End Sub
Private Sub TreeView_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView.AfterSelect
' TODO: Add code to change the listview contents based on the currently-selected node of the treeview
LoadListView()
End Sub
Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
'ShellExecute hwnd, "open", "C:\test.txt", vbNullString, "C:\", 1
'ind i under Command1_Click()
Private Sub AgroQToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AgroQToolStripMenuItem.Click
Call ShellExecute(0, "open", "C:\test.doc", vbNullString, "C:\", 1)
End Sub