private bool ValidationContent() { string ip = tb_IpAddress.Text.Trim(); string loginname = tb_LoginName.Text.Trim(); string password = tb_Password.Text.Trim(); if (!CRegex.IsIpAddress(ip)) { MessageBox.Show(ip + " IP地址有误(例:192.168.0.100),请重新输入。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_IpAddress.Focus(); return(false); } if (loginname.Length == 0) { MessageBox.Show("登录名不能为空,请重新输入。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_LoginName.Focus(); return(false); } if (password.Length == 0) { MessageBox.Show("密码不能为空,请重新输入。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); tb_Password.Focus(); return(false); } return(true); }