我有點困惑如何做到這一點。我想要做的是當我點擊Button1
,我的程序將在資源管理器中打開一個文件夾,第二個按鈕將打開一個文件作爲文本文件。按鈕,打開應用程序路徑+特定文件夾
這裏是我的代碼:
按鈕1個
Process.Start("explorer.exe", Application.ExecutablePath + "\mvram.biz")
按鈕2
Process.Start("Notepad.Exe", "README.txt")
我的問題是,每次我點擊按鈕,它會打開我的文檔。它必須打開APPpath +特定文件夾。
編輯:
Public Class Form1
Private Sub ExcisionButtonDefault5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcisionButtonDefault5.Click
Me.Close()
End Sub
Private Sub ExcisionButtonDefault1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcisionButtonDefault1.Click
Dim path As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & "\mvram.biz\"
Process.Start("explorer.exe", path)
End Sub
Private Sub ExcisionButtonDefault2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcisionButtonDefault2.Click
Process.Start("explorer.exe", Application.StartupPath & "\Documents")
End Sub
Private Sub ExcisionButtonDefault3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcisionButtonDefault3.Click
Process.Start("Notepad.Exe", "/select," & "README.txt")
End Sub
Private Sub ExcisionButtonDefault4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcisionButtonDefault4.Click
Process.Start("explorer.exe", System.Windows.Forms.Application.StartupPath + "\Presentation")
End Sub
Private Sub ExcisionButtonDefault6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcisionButtonDefault6.Click
System.Diagnostics.Process.Start("http://www.mvram.biz")
End Sub
End Class
當你說「每次我點擊按鈕」你的意思是'Button1'? – davidsbro
是先生按鈕1 按鈕2是我試圖打開Readme.txt,但文件沒有找到 請幫助我先生目前堅持這一 – blademaster
看看這個:[您的需求的例子] [ 1] [1]:http://stackoverflow.com/questions/6532222/how-do-i-open-a-windows-explorer-window-with-a-specific-folder-selected – Brainarts