2011年7月13日 星期三

009-超簡單的登入帳密檢查

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s1, s2;
            string p1, p2;

            s1 = p1 = "1234";
            s2 = textBox1.Text;
            p2 = textBox2.Text;

            int result1,result2;

            result1 = s1.CompareTo(s2);
            result2 = p1.CompareTo(p2);

            if (result1 == 0 && result2 == 0)
            {
                MessageBox.Show("歡迎光臨");
            }
            else
            {
                MessageBox.Show("帳號或密碼錯誤");
            }

        }
    }
}