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;

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

        private void button1_Click(object sender, EventArgs e)
        {
            string  myt = "" ;
            string[] mya = new string[4];
            string mys = ".";
            mya = textBox1.Text.Split(mys.ToCharArray(), 4);
            for (int i = 0; i < 4; i++)
            {
                if (Convert.ToInt32(mya[i]) >= 256)
                {
                    myt = "IP地址不合法";
                    break;
                }
                else
                {
                    myt = "IP地址合法";

                }
            }
            MessageBox.Show(this, myt, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
}
