登录验证类

登录验证类_第1张图片

前台form1里的代码:

private void button1_Click(object sender, EventArgs e)

        {

            String u, p;

            My_Msg mm1;

            u = textBox1.Text;

            p = textBox2.Text;

            Verify.Verify_Login(u, p);

            mm1 = Verify.msg1;

            if (mm1.is_OK == true)

            {

                MessageBox.Show("消息:" + mm1.msg, "登录成功");

            }

            else

            {

                MessageBox.Show("消息:" + mm1.msg, "登录失败");

            }

        }

验证消息类代码:

class My_Msg

    {

        public Boolean is_OK;

        public String msg;

        public My_Msg(Boolean a, String b)

        {

            is_OK = a;

            msg = b;

        }

    }

验证类代码:

class Verify

    {

        public static My_Msg msg1;

        public static void Verify_Login(String user_name, String pwd)

        {

            //经过一番复杂的操作之后,我们认定:

            msg1 = new My_Msg(true, "长得帅的都成功");

            //msg1=new My_Msg(false,"丑拒!");

        }

    }

你可能感兴趣的:(登录验证类)