Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net.NetworkInformation;
using System.Web;
using System.Net;



namespace WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
          
           
            Process.Start("ping",192.168.42.145");
            
         

        }
    }
}




I m usng this code bt as soon as i click on button ping window get open and closed ...pls help me....thanks in advance....
Posted
Comments
Sergey Alexandrovich Kryukov 25-Dec-12 13:58pm    
Why?!
—SA

1 solution

It makes absolutely no sense to start a separate process, especially just for ping. How are you going to interact with this process? — the processes are isolated.

Instead, use the class System.Net.NetworkInformation.Ping in your own process:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx[^].

Good luck,
—SA
 
Share this answer
 
Comments
Niks_utake 28-Dec-12 9:20am    
ok thank you
Sergey Alexandrovich Kryukov 28-Dec-12 12:35pm    
You are welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900