我尝试在多个文本框中执行多个字符串。当进程处理开始按钮时,文本框内的字符串将合并为一个并运行它。这是我的代码:
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
TextBox2.Text = "C:\Windows\SysWOW64\ForceBindIP.exe"
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
TextBox3.Text = "192.168.0.1"
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox4.Text = TextBox3.Text & TextBox1.Text & TextBox1.Text()
Process.Start(TextBox4.Text)
End Sub
我希望将命令设为textbox4.text,就像这样
C:\ Windows \ SysWOW64 \ ForceBindIP.exe 192.168.0.1“C:\ Program Files (x86)\ Mozilla Firefox \ firefox.exe“
我知道这段代码有错,但我不知道哪一部分。还有其他简单的方法吗?
答案 0 :(得分:0)
我怀疑你想将其他文本框值作为参数传递。
Process.Start有一个接受参数参数的重载:See this for more info。
所以这就是你想要的东西:
Process.Start(Textbox2.text, Textbox3.text + " " + TextBox1.Text)