Answer to Question #291971 in C# for hajar

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.


1
Expert's answer
2022-01-31T15:08:02-0500
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS