主题:C#实现ping功能(有错,谁能帮着修改下啊)
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net ;
using System.Net.Sockets ;
namespace 实现Ping命令
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{}
//
// Windows 窗体设计器支持所必需的
//
private void InitializeComponent ( )
{
this.textBox1 = new System.Windows.Forms.TextBox ( ) ;
this.label1 = new System.Windows.Forms.Label ( ) ;
this.listBox1 = new System.Windows.Forms.ListBox ( ) ;
this.button1 = new System.Windows.Forms.Button ( ) ;
this.SuspendLayout ( ) ;
this.textBox1.Location = new System.Drawing.Point ( 116 , 14 ) ;
this.textBox1.Name = "textBox1" ;
this.textBox1.Size = new System.Drawing.Size ( 148 , 21 ) ;
this.textBox1.TabIndex = 0 ;
this.textBox1.Text = "" ;
this.textBox1.TextChanged += new System.EventHandler ( this.textBox1_TextChanged ) ;
this.label1.Location = new System.Drawing.Point ( 12 , 14 ) ;
this.label1.Name = "label1" ;
this.label1.TabIndex = 1 ;
this.label1.Text = "请输入主机名:" ;
this.listBox1.BackColor = System.Drawing.SystemColors.WindowText ;
this.listBox1.ForeColor = System.Drawing.SystemColors.Window ;
this.listBox1.ItemHeight = 12 ;
this.listBox1.Location = new System.Drawing.Point ( 6 , 42 ) ;
this.listBox1.Name = "listBox1" ;
this.listBox1.Size = new System.Drawing.Size ( 400 , 280 ) ;
this.listBox1.TabIndex = 2 ;
this.button1.Location = new System.Drawing.Point ( 274 , 12 ) ;
this.button1.Name = "button1" ;
this.button1.TabIndex = 3 ;
this.button1.Text = "Ping" ;
this.button1.Click += new System.EventHandler ( this.button1_Click ) ;
this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ;
this.ClientSize = new System.Drawing.Size ( 410 , 333 ) ;
this.Controls.AddRange ( new System.Windows.Forms.Control[ ] {
this.button1 ,
this.listBox1 ,
this.label1 ,
this.textBox1 } ) ;
this.MaximizeBox = false ;
this.Name = "Form1" ;
this.Text = "Visual C#实现Ping" ;
this.ResumeLayout ( false ) ;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net ;
using System.Net.Sockets ;
namespace 实现Ping命令
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{}
//
// Windows 窗体设计器支持所必需的
//
private void InitializeComponent ( )
{
this.textBox1 = new System.Windows.Forms.TextBox ( ) ;
this.label1 = new System.Windows.Forms.Label ( ) ;
this.listBox1 = new System.Windows.Forms.ListBox ( ) ;
this.button1 = new System.Windows.Forms.Button ( ) ;
this.SuspendLayout ( ) ;
this.textBox1.Location = new System.Drawing.Point ( 116 , 14 ) ;
this.textBox1.Name = "textBox1" ;
this.textBox1.Size = new System.Drawing.Size ( 148 , 21 ) ;
this.textBox1.TabIndex = 0 ;
this.textBox1.Text = "" ;
this.textBox1.TextChanged += new System.EventHandler ( this.textBox1_TextChanged ) ;
this.label1.Location = new System.Drawing.Point ( 12 , 14 ) ;
this.label1.Name = "label1" ;
this.label1.TabIndex = 1 ;
this.label1.Text = "请输入主机名:" ;
this.listBox1.BackColor = System.Drawing.SystemColors.WindowText ;
this.listBox1.ForeColor = System.Drawing.SystemColors.Window ;
this.listBox1.ItemHeight = 12 ;
this.listBox1.Location = new System.Drawing.Point ( 6 , 42 ) ;
this.listBox1.Name = "listBox1" ;
this.listBox1.Size = new System.Drawing.Size ( 400 , 280 ) ;
this.listBox1.TabIndex = 2 ;
this.button1.Location = new System.Drawing.Point ( 274 , 12 ) ;
this.button1.Name = "button1" ;
this.button1.TabIndex = 3 ;
this.button1.Text = "Ping" ;
this.button1.Click += new System.EventHandler ( this.button1_Click ) ;
this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ;
this.ClientSize = new System.Drawing.Size ( 410 , 333 ) ;
this.Controls.AddRange ( new System.Windows.Forms.Control[ ] {
this.button1 ,
this.listBox1 ,
this.label1 ,
this.textBox1 } ) ;
this.MaximizeBox = false ;
this.Name = "Form1" ;
this.Text = "Visual C#实现Ping" ;
this.ResumeLayout ( false ) ;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>