📄 courseelect.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace 教务管理系统
{
/// <summary>
/// CourseElect 的摘要说明。
/// </summary>
public class CourseElect : System.Windows.Forms.Form
{
private DataTable electTable=new DataTable();//保存学生的选课信息
private DataTable courseTable=new DataTable();//保存可选课程信息
private DataView dv;//可选课程的视图
private string studentID;//保存选课的学生信息
private string stduentName;//选课的学生的姓名
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txt1;
private System.Windows.Forms.TextBox txt2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txt3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txt4;
private System.Windows.Forms.TextBox txt5;
private System.Windows.Forms.TextBox txt6;
private System.Windows.Forms.TextBox txt7;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.Button btnElect;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnView;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CourseElect()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CourseElect));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txt1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.txt2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txt3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.txt4 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btnSearch = new System.Windows.Forms.Button();
this.btnElect = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button();
this.btnView = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.txt5 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txt6 = new System.Windows.Forms.TextBox();
this.txt7 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txt1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.txt2);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txt3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Location = new System.Drawing.Point(0, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(696, 53);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "学生信息";
//
// txt1
//
this.txt1.Location = new System.Drawing.Point(88, 24);
this.txt1.Name = "txt1";
this.txt1.TabIndex = 1;
this.txt1.Text = "";
this.txt1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt1_KeyPress);
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 16);
this.label1.TabIndex = 0;
this.label1.Text = "学号";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txt2
//
this.txt2.Location = new System.Drawing.Point(272, 24);
this.txt2.Name = "txt2";
this.txt2.ReadOnly = true;
this.txt2.TabIndex = 1;
this.txt2.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(224, 28);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 16);
this.label2.TabIndex = 0;
this.label2.Text = "姓名";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txt3
//
this.txt3.Location = new System.Drawing.Point(480, 24);
this.txt3.Name = "txt3";
this.txt3.ReadOnly = true;
this.txt3.TabIndex = 1;
this.txt3.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(432, 28);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 16);
this.label4.TabIndex = 0;
this.label4.Text = "班级";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 56);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(696, 224);
this.dataGrid1.TabIndex = 1;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.dataGrid2);
this.groupBox2.Controls.Add(this.groupBox3);
this.groupBox2.Location = new System.Drawing.Point(0, 280);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(696, 224);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "课程信息";
//
// dataGrid2
//
this.dataGrid2.CaptionVisible = false;
this.dataGrid2.DataMember = "";
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(216, 16);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.ReadOnly = true;
this.dataGrid2.Size = new System.Drawing.Size(472, 200);
this.dataGrid2.TabIndex = 1;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.txt4);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Controls.Add(this.btnSearch);
this.groupBox3.Controls.Add(this.btnElect);
this.groupBox3.Controls.Add(this.btnDelete);
this.groupBox3.Controls.Add(this.btnView);
this.groupBox3.Controls.Add(this.label5);
this.groupBox3.Controls.Add(this.txt5);
this.groupBox3.Controls.Add(this.label6);
this.groupBox3.Controls.Add(this.txt6);
this.groupBox3.Controls.Add(this.txt7);
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Location = new System.Drawing.Point(8, 16);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(200, 200);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
//
// txt4
//
this.txt4.Location = new System.Drawing.Point(72, 16);
this.txt4.Name = "txt4";
this.txt4.Size = new System.Drawing.Size(112, 21);
this.txt4.TabIndex = 2;
this.txt4.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 16);
this.label3.TabIndex = 1;
this.label3.Text = "课程拼音";
//
// btnSearch
//
this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSearch.Location = new System.Drawing.Point(16, 120);
this.btnSearch.Name = "btnSearch";
this.btnSearch.TabIndex = 0;
this.btnSearch.Text = "查询";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// btnElect
//
this.btnElect.Enabled = false;
this.btnElect.Image = ((System.Drawing.Image)(resources.GetObject("btnElect.Image")));
this.btnElect.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnElect.Location = new System.Drawing.Point(112, 120);
this.btnElect.Name = "btnElect";
this.btnElect.TabIndex = 0;
this.btnElect.Text = "选课";
this.btnElect.Click += new System.EventHandler(this.btnElect_Click);
//
// btnDelete
//
this.btnDelete.Enabled = false;
this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
this.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDelete.Location = new System.Drawing.Point(16, 160);
this.btnDelete.Name = "btnDelete";
this.btnDelete.TabIndex = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -