📄 yonghumimaxiugai.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace tsh
{
public partial class yonghumimaxiugai : Form
{
public yonghumimaxiugai()
{
InitializeComponent();
}
DB.ClsSQL sql = new DB.ClsSQL(".", "mylw", "sa", "", 3);
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(((e.KeyChar >= '0') && (e.KeyChar <= '9')) || e.KeyChar <= 31) || e.KeyChar == '.')
{
e.Handled = true;
}
if (e.KeyChar == 13)
{
textBox2.Focus();
}
}
private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.ToString() == "Up")
textBox1.Focus();
if (e.KeyCode.ToString() == "Down")
textBox3.Focus();
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.ToString() == "Down")
textBox2.Focus();
}
private void textBox3_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.ToString() == "Up")
textBox2.Focus();
if (e.KeyCode.ToString() == "Down")
textBox4.Focus();
}
private void textBox4_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.ToString() == "Up")
textBox3.Focus();
if (e.KeyCode.ToString() == "Down")
textBox1.Focus();
}
private void yonghumimaxiugai_Load(object sender, EventArgs e)
{
textBox1.Focus();
}
private void button1_Click(object sender, EventArgs e)
{ DataSet ds;
string s1="select * from employee where yuangongbianhao='"+textBox1.Text+"' and mima='"+textBox2.Text+"'";
ds=sql.DBToDS(s1, "employee");
if (ds.Tables["employee"].Rows.Count > 0)
{
if (textBox3.Text == textBox4.Text)
{
string s2 = "update employee set mima='" + textBox3.Text + "' where yuangongbianhao='" + textBox1.Text + "'";
sql.SQLCommand(s2);
MessageBox.Show("修改密码成功!!!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
textBox1.Text = "";
textBox1.Focus();
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
}
else
{
MessageBox.Show("两次输入的新密码不一致!!!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
textBox3.Text = "";
textBox3.Focus();
textBox4.Text = "";
}
}
else
{
MessageBox.Show("帐号或密码错误!!!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
textBox1.Text = "";
textBox1.Focus();
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
textBox3.Focus();
}
}
private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
textBox4.Focus();
}
}
private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
textBox1.Focus();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -