📄 frmsearch.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using Business;
namespace GUI
{
/// <summary>
/// frmSearch 的摘要说明。
/// </summary>
public class frmSearch : System.Windows.Forms.Form
{
private System.Windows.Forms.ComboBox cmbSearchType;
private System.Windows.Forms.TextBox txtSearch;
private System.Windows.Forms.Button btnExit;
private ScoreOperate scoreoperate;
private CourseOperate courseoperate;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmSearch()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
scoreoperate=new ScoreOperate();
courseoperate=new CourseOperate();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.cmbSearchType = new System.Windows.Forms.ComboBox();
this.txtSearch = new System.Windows.Forms.TextBox();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// cmbSearchType
//
this.cmbSearchType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbSearchType.Items.AddRange(new object[] {
"按学生姓名搜索学生成绩情况",
"按班级名搜索班级情况"});
this.cmbSearchType.Location = new System.Drawing.Point(32, 64);
this.cmbSearchType.Name = "cmbSearchType";
this.cmbSearchType.Size = new System.Drawing.Size(232, 20);
this.cmbSearchType.TabIndex = 0;
//
// txtSearch
//
this.txtSearch.Location = new System.Drawing.Point(32, 16);
this.txtSearch.Name = "txtSearch";
this.txtSearch.Size = new System.Drawing.Size(232, 21);
this.txtSearch.TabIndex = 1;
this.txtSearch.Text = "";
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(88, 120);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(128, 32);
this.btnExit.TabIndex = 2;
this.btnExit.Text = "给老子搜";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// frmSearch
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 160);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.txtSearch);
this.Controls.Add(this.cmbSearchType);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "frmSearch";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "frmSearch";
this.ResumeLayout(false);
}
#endregion
//点击搜索button
private void btnExit_Click(object sender, System.EventArgs e)
{
if(this.cmbSearchType.Text=="" || this.txtSearch.Text=="")
{
MessageBox.Show("keyword和searchType都不为空好不好?");
}
else
{
if(this.cmbSearchType.Text=="按学生姓名搜索学生成绩情况")
{
string studentname=this.txtSearch.Text;
DataSet ds=new DataSet();
ds=scoreoperate.selectwithStudentnameinScore_View(studentname);
frmDataGrid frmdatagrid=new frmDataGrid(ds);
frmdatagrid.ShowDialog();
}
if(this.cmbSearchType.Text=="按班级名搜索班级情况")
{
string classname=this.txtSearch.Text;
DataSet ds=new DataSet();
ds=courseoperate.selectbyname(classname);
frmDataGrid frmdatagrid=new frmDataGrid(ds);
frmdatagrid.ShowDialog();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -