0

我想做一个浏览按钮,当你搜索你的程序并且clicked ok它进入一个TextBox(我已经得到这个)但是我想用另一个按钮启动你选择的程序。

我怎样才能做到这一点?

这是我已经拥有的代码:

Public Class Form1

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Using a As New OpenFileDialog()
        If a.ShowDialog() = DialogResult.OK Then
            Me.TextBox1.Text = a.FileName
        End If
    End Using
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Using b As New OpenFileDialog()
        If b.ShowDialog() = DialogResult.OK Then
            Me.TextBox2.Text = b.FileName
        End If
    End Using
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
    Using c As New OpenFileDialog()
        If c.ShowDialog() = DialogResult.OK Then
            Me.TextBox3.Text = c.FileName
        End If
    End Using
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
    Using d As New OpenFileDialog()
        If d.ShowDialog() = DialogResult.OK Then
            Me.TextBox4.Text = d.FileName
        End If
    End Using
  End Sub
End Class
4

1 回答 1

2

您可以使用Process.Start

将此添加到您的按钮单击事件(已更新到 VB.net)

if Not String.IsNullorEmpty(TextBox1.Text)    
   Process.Start(me.TextBox1.Text)
end if
于 2013-01-13T11:57:49.567 回答