search.cs
来自「实现企业的人事管理」· CS 代码 · 共 65 行
CS
65 行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace renshiguanli
{
public partial class Search : Form
{
public static string name_search;
public static string email_search;
public static int deptid_search;
public Search()
{
InitializeComponent();
Information.sql.set_combobox(comboBox_department);
comboBox_department .SelectedIndex = -1;
name_search = "";
email_search = "";
deptid_search = -1;
}
private void btn_cancle_Click(object sender, EventArgs e)
{
this.Close();
}
private void btn_0k_Click(object sender, EventArgs e)
{
// textBox_mail.Text = comboBox_department.SelectedValue.ToString();
Regex mail = new Regex(@"^\w{1,20}@\w{1,20}.\w{1,20}");
if (!mail.IsMatch(textBox_mail.Text) && textBox_mail.Text != "")
{
MessageBox.Show("Email格式错误");
}
else
{
name_search = textBox_name.Text;
email_search = textBox_mail.Text;
try
{
deptid_search = (int)comboBox_department.SelectedValue;
}
catch
{
deptid_search = -1;
}
if (name_search == "" && email_search == "" && deptid_search == -1)
{
MessageBox.Show("查询条件不能全部为空!");
}
else
{
this.DialogResult = DialogResult.OK;
}
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?