Question #291971

. Write program, that run one of two applications (Calculator or MS Paint) after user pushed corresponding button “Run”. In editbox user indicates the time (in seconds) after which the application closes.


Expert's answer

using System.Threading;

void Button1Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName = "calc";    //p.StartInfo.FileName = "mspaint";  - for MS Paint 
            p.Start();
            Thread.Sleep(Convert.ToInt32(textBox1.Text) * 1000);
            p.Kill();
        }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS