Reputation: 11
I can get the ping to work, I'm having trouble figuring out how to pass the value of a text box as an argument so I can ping the value from the text box. Can someone point me in the right direction?
Process test = new Process();
test.StartInfo.FileName = "ping";
test.StartInfo.UseShellExecute = false;
test.StartInfo.Arguments = "www.google.com";
test.StartInfo.RedirectStandardOutput = true;
test.Start();
textBox1.Text = test.StandardOutput.ReadToEnd();
Upvotes: 1
Views: 398
Reputation: 585
Change test.StartInfo.Arguments = "www.google.com";
to test.StartInfo.Arguments = textBox1.Text;
, assuming that textBox1 is the text box you're interested in.
Upvotes: 1