📄 selectcourse.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using StudentManage.DataLevel;
namespace StudentManage.UILevel
{
/// <summary>
/// SelectCourse 的摘要说明。
/// </summary>
public class SelectCourse : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboSemester;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Button btnExit;
private SqlConnection conn1=null;
private SqlDataAdapter sqlDataAdapter1=null;
private DataSet DataSetDep=new DataSet("Course");
private SqlCommand Command1=null;
private SqlDataReader DataReader1=null;
private string selectStr=null;
private string commandStr=null;
private System.Windows.Forms.ComboBox comboClass;
private System.Windows.Forms.ComboBox comboDepartment;
private string department=null;
private string classname=null;
private string semester=null;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnOk;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public SelectCourse()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.conn1=new SqlConnection(DataLevel.Connection.ConnString);
this.selectStr="select * from SelectCourse";
this.Command1=new SqlCommand();
this.Command1.Connection=this.conn1;
//
// 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(SelectCourse));
this.listBox1 = new System.Windows.Forms.ListBox();
this.listBox2 = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.btnAdd = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.btnDelete = new System.Windows.Forms.Button();
this.comboSemester = new System.Windows.Forms.ComboBox();
this.comboClass = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.comboDepartment = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnOk = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.btnApply = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.ItemHeight = 12;
this.listBox1.Location = new System.Drawing.Point(24, 160);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(160, 244);
this.listBox1.TabIndex = 0;
//
// listBox2
//
this.listBox2.ItemHeight = 12;
this.listBox2.Location = new System.Drawing.Point(304, 160);
this.listBox2.MultiColumn = true;
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(160, 244);
this.listBox2.TabIndex = 1;
//
// label1
//
this.label1.Location = new System.Drawing.Point(56, 136);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 23);
this.label1.TabIndex = 2;
this.label1.Text = "所有课程";
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(216, 216);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(64, 23);
this.btnAdd.TabIndex = 3;
this.btnAdd.Text = "添加->";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 23);
this.label2.TabIndex = 4;
this.label2.Text = "学期";
//
// btnDelete
//
this.btnDelete.Location = new System.Drawing.Point(216, 320);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(64, 23);
this.btnDelete.TabIndex = 5;
this.btnDelete.Text = "<-删除";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// comboSemester
//
this.comboSemester.Location = new System.Drawing.Point(64, 56);
this.comboSemester.Name = "comboSemester";
this.comboSemester.Size = new System.Drawing.Size(96, 20);
this.comboSemester.TabIndex = 6;
//
// comboClass
//
this.comboClass.Location = new System.Drawing.Point(280, 24);
this.comboClass.Name = "comboClass";
this.comboClass.Size = new System.Drawing.Size(112, 20);
this.comboClass.TabIndex = 7;
//
// label3
//
this.label3.Location = new System.Drawing.Point(232, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 23);
this.label3.TabIndex = 8;
this.label3.Text = "班级";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 23);
this.label4.TabIndex = 9;
this.label4.Text = "院系";
//
// comboDepartment
//
this.comboDepartment.Location = new System.Drawing.Point(64, 24);
this.comboDepartment.Name = "comboDepartment";
this.comboDepartment.Size = new System.Drawing.Size(96, 20);
this.comboDepartment.TabIndex = 10;
this.comboDepartment.SelectedIndexChanged += new System.EventHandler(this.comboDepartment_SelectedIndexChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnOk);
this.groupBox1.Controls.Add(this.comboDepartment);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.comboClass);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.comboSemester);
this.groupBox1.Location = new System.Drawing.Point(16, 16);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(480, 104);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
//
// btnOk
//
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.Image = ((System.Drawing.Image)(resources.GetObject("btnOk.Image")));
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.Location = new System.Drawing.Point(304, 64);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(56, 24);
this.btnOk.TabIndex = 103;
this.btnOk.Text = "确认";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// label5
//
this.label5.Location = new System.Drawing.Point(352, 128);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 23);
this.label5.TabIndex = 12;
this.label5.Text = "选定课程";
//
// btnApply
//
this.btnApply.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnApply.Image = ((System.Drawing.Image)(resources.GetObject("btnApply.Image")));
this.btnApply.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnApply.Location = new System.Drawing.Point(352, 448);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(56, 24);
this.btnApply.TabIndex = 102;
this.btnApply.Text = "提交";
this.btnApply.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// btnExit
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -