Click here to Skip to main content
11,715,450 members (81,062 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0
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 25-Dec-12 7:21am
Comments
Sergey Alexandrovich Kryukov at 25-Dec-12 13:58pm
   
Why?!
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
Niks_utake at 28-Dec-12 9:20am
   
ok thank you
Sergey Alexandrovich Kryukov at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 495
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 125
0 Sergey Alexandrovich Kryukov 785
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320


Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100