C# 判断网络是否通的代码
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int conn, int val);

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int Out;
            if (InternetGetConnectedState(out Out, 0) == true)
            {
                MessageBox.Show("Connected !");
            }
            else
            {
                MessageBox.Show("Not Connected !");
            }
        }
C# 判断网络是否通的代码

 

判断邮箱地址是否有效的参考代码

C# 判断网络是否通的代码
        private void button1_Click(object sender, EventArgs e)
        {
            string pattern = null;
            pattern = "^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";

            if (Regex.IsMatch("feedback@net-informations.com", pattern))
            {
                MessageBox.Show ("Valid Email address ");
            }
            else
            {
                MessageBox.Show("Not a valid Email address ");
            }
        }
C# 判断网络是否通的代码
C# 判断网络是否通的代码
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int conn, int val);

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int Out;
            if (InternetGetConnectedState(out Out, 0) == true)
            {
                MessageBox.Show("Connected !");
            }
            else
            {
                MessageBox.Show("Not Connected !");
            }
        }
C# 判断网络是否通的代码

 

判断邮箱地址是否有效的参考代码

C# 判断网络是否通的代码
        private void button1_Click(object sender, EventArgs e)
        {
            string pattern = null;
            pattern = "^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";

            if (Regex.IsMatch("feedback@net-informations.com", pattern))
            {
                MessageBox.Show ("Valid Email address ");
            }
            else
            {
                MessageBox.Show("Not a valid Email address ");
            }
        }
C# 判断网络是否通的代码

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
相关资源
相似解决方案