回 帖 发 新 帖 刷新版面

主题: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>
  

回复列表 (共2个回复)

沙发


        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        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();
            // 
            // textBox1
            // 
            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 = "";
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(12, 14);
            this.label1.Name = "label1";
            this.label1.TabIndex = 1;
            this.label1.Text = "请输入主机名:";
            // 
            // listBox1
            // 
            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;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(280, 12);
            this.button1.Name = "button1";
            this.button1.TabIndex = 3;
            this.button1.Text = "Ping";
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(410, 333);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.listBox1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.textBox1);
            this.MaximizeBox = false;
            this.Name = "Form1";
            this.Text = "Visual C#实现Ping";
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static  Main() 
        {
            Application.Run(new Form1());
        }
    }
}

板凳

谁会啊?帮忙看下啊

我来回复

您尚未登录,请登录后再回复。点此登录或注册