⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form_xyfb.cs

📁 一个很简单的考试系统。实用性很强啊!数据库在里面
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;

namespace bizdb
{
	/// <summary>
	/// Form_xyfb 的摘要说明。
	/// </summary>
	public class Form_xyfb : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ListBox lst_bjxy;
		private System.Windows.Forms.ListBox lst_xybj;
		private System.Windows.Forms.Label Lbl_xzbj;
		private System.Windows.Forms.Label Lbl_bmrq;
		private System.Windows.Forms.Label Lbl_zyb;
		public System.Windows.Forms.ComboBox Cbo_xzbj;
		private System.Windows.Forms.ComboBox Cbo_skdd;
		private System.Windows.Forms.ComboBox Cbo_yxfs;
		private System.Windows.Forms.ComboBox Cbo_zyb;
		private System.Windows.Forms.Button Btn_commit;
		private System.Windows.Forms.Button Btn_delall;
		private System.Windows.Forms.Button Btn_addall;
		private System.Windows.Forms.Button Btn_del;
		private System.Windows.Forms.Button Btn_add;
		private System.Windows.Forms.DataGrid Grd_xyfb;
		private System.Windows.Forms.DateTimePicker dtp_bmrq;
		private System.Data.DataSet dataSet1;
		private System.Data.DataTable dataTable1;

		private dbAccess db = new dbAccess();
		string strcmd;
		public SqlConnection cnserver=new SqlConnection();
		
		public SqlCommand cmd=new SqlCommand();
		public SqlDataAdapter ad=new SqlDataAdapter();
		private System.Windows.Forms.Label Lbl_fbxy;
		private System.Windows.Forms.Label lbl_bjxy;
		private System.Windows.Forms.CheckBox chk_ybm;
		private System.Windows.Forms.CheckBox chk_yxk;

		

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form_xyfb()
		{
			//
			// 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()
		{
			this.lst_bjxy = new System.Windows.Forms.ListBox();
			this.lst_xybj = new System.Windows.Forms.ListBox();
			this.Lbl_fbxy = new System.Windows.Forms.Label();
			this.Lbl_xzbj = new System.Windows.Forms.Label();
			this.Lbl_bmrq = new System.Windows.Forms.Label();
			this.Lbl_zyb = new System.Windows.Forms.Label();
			this.chk_ybm = new System.Windows.Forms.CheckBox();
			this.chk_yxk = new System.Windows.Forms.CheckBox();
			this.Cbo_xzbj = new System.Windows.Forms.ComboBox();
			this.Cbo_skdd = new System.Windows.Forms.ComboBox();
			this.Cbo_yxfs = new System.Windows.Forms.ComboBox();
			this.Cbo_zyb = new System.Windows.Forms.ComboBox();
			this.Btn_commit = new System.Windows.Forms.Button();
			this.Btn_delall = new System.Windows.Forms.Button();
			this.Btn_addall = new System.Windows.Forms.Button();
			this.Btn_del = new System.Windows.Forms.Button();
			this.Btn_add = new System.Windows.Forms.Button();
			this.Grd_xyfb = new System.Windows.Forms.DataGrid();
			this.dtp_bmrq = new System.Windows.Forms.DateTimePicker();
			this.dataSet1 = new System.Data.DataSet();
			this.dataTable1 = new System.Data.DataTable();
			this.lbl_bjxy = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.Grd_xyfb)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit();
			this.SuspendLayout();
			// 
			// lst_bjxy
			// 
			this.lst_bjxy.ItemHeight = 12;
			this.lst_bjxy.Location = new System.Drawing.Point(536, 328);
			this.lst_bjxy.Name = "lst_bjxy";
			this.lst_bjxy.Size = new System.Drawing.Size(264, 184);
			this.lst_bjxy.TabIndex = 61;
			// 
			// lst_xybj
			// 
			this.lst_xybj.ItemHeight = 12;
			this.lst_xybj.Location = new System.Drawing.Point(64, 312);
			this.lst_xybj.Name = "lst_xybj";
			this.lst_xybj.Size = new System.Drawing.Size(272, 196);
			this.lst_xybj.TabIndex = 60;
			// 
			// Lbl_fbxy
			// 
			this.Lbl_fbxy.Location = new System.Drawing.Point(64, 296);
			this.Lbl_fbxy.Name = "Lbl_fbxy";
			this.Lbl_fbxy.Size = new System.Drawing.Size(120, 16);
			this.Lbl_fbxy.TabIndex = 58;
			this.Lbl_fbxy.Text = "当前待分班学员列表";
			// 
			// Lbl_xzbj
			// 
			this.Lbl_xzbj.Location = new System.Drawing.Point(536, 288);
			this.Lbl_xzbj.Name = "Lbl_xzbj";
			this.Lbl_xzbj.Size = new System.Drawing.Size(112, 16);
			this.Lbl_xzbj.TabIndex = 57;
			this.Lbl_xzbj.Text = "选择待分配的班级";
			// 
			// Lbl_bmrq
			// 
			this.Lbl_bmrq.Location = new System.Drawing.Point(72, 216);
			this.Lbl_bmrq.Name = "Lbl_bmrq";
			this.Lbl_bmrq.Size = new System.Drawing.Size(136, 32);
			this.Lbl_bmrq.TabIndex = 56;
			this.Lbl_bmrq.Text = "请选择已报名学生的起始报名日期";
			// 
			// Lbl_zyb
			// 
			this.Lbl_zyb.Location = new System.Drawing.Point(536, 216);
			this.Lbl_zyb.Name = "Lbl_zyb";
			this.Lbl_zyb.Size = new System.Drawing.Size(144, 32);
			this.Lbl_zyb.TabIndex = 55;
			this.Lbl_zyb.Text = "选择现有专业方向和三个方式下的可用班级";
			// 
			// chk_ybm
			// 
			this.chk_ybm.Location = new System.Drawing.Point(536, 256);
			this.chk_ybm.Name = "chk_ybm";
			this.chk_ybm.TabIndex = 54;
			this.chk_ybm.Text = "关联上课地点";
			this.chk_ybm.CheckedChanged += new System.EventHandler(this.chk_ybm_CheckedChanged);
			// 
			// chk_yxk
			// 
			this.chk_yxk.Location = new System.Drawing.Point(72, 256);
			this.chk_yxk.Name = "chk_yxk";
			this.chk_yxk.TabIndex = 53;
			this.chk_yxk.Text = "关联研修方式";
			this.chk_yxk.CheckedChanged += new System.EventHandler(this.chk_yxk_CheckedChanged);
			// 
			// Cbo_xzbj
			// 
			this.Cbo_xzbj.Location = new System.Drawing.Point(680, 288);
			this.Cbo_xzbj.Name = "Cbo_xzbj";
			this.Cbo_xzbj.Size = new System.Drawing.Size(120, 20);
			this.Cbo_xzbj.TabIndex = 52;
			this.Cbo_xzbj.SelectedIndexChanged += new System.EventHandler(this.Cbo_xzbj_SelectedIndexChanged);
			// 
			// Cbo_skdd
			// 
			this.Cbo_skdd.Location = new System.Drawing.Point(680, 256);
			this.Cbo_skdd.Name = "Cbo_skdd";
			this.Cbo_skdd.Size = new System.Drawing.Size(120, 20);
			this.Cbo_skdd.TabIndex = 50;
			this.Cbo_skdd.SelectedIndexChanged += new System.EventHandler(this.Cbo_skdd_SelectedIndexChanged);
			// 
			// Cbo_yxfs
			// 
			this.Cbo_yxfs.Location = new System.Drawing.Point(216, 256);
			this.Cbo_yxfs.Name = "Cbo_yxfs";
			this.Cbo_yxfs.Size = new System.Drawing.Size(120, 20);
			this.Cbo_yxfs.TabIndex = 49;
			this.Cbo_yxfs.SelectedIndexChanged += new System.EventHandler(this.Cbo_yxfs_SelectedIndexChanged);
			// 
			// Cbo_zyb
			// 
			this.Cbo_zyb.Location = new System.Drawing.Point(680, 216);
			this.Cbo_zyb.Name = "Cbo_zyb";
			this.Cbo_zyb.Size = new System.Drawing.Size(120, 20);
			this.Cbo_zyb.TabIndex = 48;
			this.Cbo_zyb.SelectedIndexChanged += new System.EventHandler(this.Cbo_zyb_SelectedIndexChanged);
			// 
			// Btn_commit
			// 
			this.Btn_commit.Location = new System.Drawing.Point(392, 480);
			this.Btn_commit.Name = "Btn_commit";
			this.Btn_commit.Size = new System.Drawing.Size(88, 32);
			this.Btn_commit.TabIndex = 47;
			this.Btn_commit.Text = "提交分班信息";
			this.Btn_commit.Click += new System.EventHandler(this.Btn_commit_Click);
			// 
			// Btn_delall
			// 
			this.Btn_delall.Location = new System.Drawing.Point(392, 424);
			this.Btn_delall.Name = "Btn_delall";
			this.Btn_delall.Size = new System.Drawing.Size(88, 32);
			this.Btn_delall.TabIndex = 46;
			this.Btn_delall.Text = "<<全部删除";
			this.Btn_delall.Click += new System.EventHandler(this.Btn_delall_Click);
			// 
			// Btn_addall
			// 
			this.Btn_addall.Location = new System.Drawing.Point(392, 368);
			this.Btn_addall.Name = "Btn_addall";
			this.Btn_addall.Size = new System.Drawing.Size(88, 32);
			this.Btn_addall.TabIndex = 45;
			this.Btn_addall.Text = "全部添加>>";
			this.Btn_addall.Click += new System.EventHandler(this.Btn_addall_Click);
			// 
			// Btn_del
			// 
			this.Btn_del.Location = new System.Drawing.Point(392, 312);
			this.Btn_del.Name = "Btn_del";
			this.Btn_del.Size = new System.Drawing.Size(88, 32);
			this.Btn_del.TabIndex = 44;
			this.Btn_del.Text = "<删除";
			this.Btn_del.Click += new System.EventHandler(this.Btn_del_Click);
			// 
			// Btn_add
			// 
			this.Btn_add.Location = new System.Drawing.Point(392, 256);
			this.Btn_add.Name = "Btn_add";
			this.Btn_add.Size = new System.Drawing.Size(88, 32);
			this.Btn_add.TabIndex = 43;
			this.Btn_add.Text = "添加>";
			this.Btn_add.Click += new System.EventHandler(this.Btn_add_Click);
			// 
			// Grd_xyfb
			// 
			this.Grd_xyfb.CaptionText = "班级所有学员信息表";
			this.Grd_xyfb.DataMember = "";
			this.Grd_xyfb.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.Grd_xyfb.Location = new System.Drawing.Point(0, 0);
			this.Grd_xyfb.Name = "Grd_xyfb";
			this.Grd_xyfb.Size = new System.Drawing.Size(928, 200);
			this.Grd_xyfb.TabIndex = 42;
			this.Grd_xyfb.Tag = "";
			// 
			// dtp_bmrq
			// 
			this.dtp_bmrq.Location = new System.Drawing.Point(216, 216);
			this.dtp_bmrq.Name = "dtp_bmrq";
			this.dtp_bmrq.Size = new System.Drawing.Size(120, 21);
			this.dtp_bmrq.TabIndex = 63;
			this.dtp_bmrq.ValueChanged += new System.EventHandler(this.dtp_bmrq_ValueChanged);
			// 
			// dataSet1
			// 
			this.dataSet1.DataSetName = "NewDataSet";
			this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN");
			this.dataSet1.Tables.AddRange(new System.Data.DataTable[] {
																		  this.dataTable1});
			// 
			// dataTable1
			// 
			this.dataTable1.TableName = "Table1";
			// 
			// lbl_bjxy
			// 
			this.lbl_bjxy.Location = new System.Drawing.Point(536, 312);
			this.lbl_bjxy.Name = "lbl_bjxy";
			this.lbl_bjxy.Size = new System.Drawing.Size(104, 16);
			this.lbl_bjxy.TabIndex = 64;
			this.lbl_bjxy.Text = "当前班级学员列表";
			// 
			// Form_xyfb
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(792, 573);
			this.Controls.Add(this.lbl_bjxy);
			this.Controls.Add(this.dtp_bmrq);
			this.Controls.Add(this.lst_bjxy);
			this.Controls.Add(this.lst_xybj);
			this.Controls.Add(this.Lbl_fbxy);
			this.Controls.Add(this.Lbl_xzbj);
			this.Controls.Add(this.Lbl_bmrq);
			this.Controls.Add(this.Lbl_zyb);
			this.Controls.Add(this.chk_ybm);
			this.Controls.Add(this.chk_yxk);
			this.Controls.Add(this.Cbo_xzbj);
			this.Controls.Add(this.Cbo_skdd);
			this.Controls.Add(this.Cbo_yxfs);
			this.Controls.Add(this.Cbo_zyb);
			this.Controls.Add(this.Btn_commit);
			this.Controls.Add(this.Btn_delall);
			this.Controls.Add(this.Btn_addall);
			this.Controls.Add(this.Btn_del);
			this.Controls.Add(this.Btn_add);
			this.Controls.Add(this.Grd_xyfb);
			this.Name = "Form_xyfb";
			this.Text = "Form_xyfb";
			this.Load += new System.EventHandler(this.Form_xyfb_Load);
			((System.ComponentModel.ISupportInitialize)(this.Grd_xyfb)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void intolst(string cmd1,string clomnname,string tablename,ListBox lst)
		{
			cnserver.ConnectionString=db.connStr;
			cnserver.Open();
			cmd.CommandText=cmd1;
			cmd.Connection=cnserver;
			ad.SelectCommand=cmd;
			dataSet1.Clear();
			try
			{
				ad.Fill(dataSet1,tablename);
				foreach(DataRow dr in dataSet1.Tables[tablename].Rows)
				{
					lst.Items.Add(dr[clomnname].ToString());
				}
			}
			catch(System.Exception m)
			{MessageBox.Show(m.Message);}
			cnserver.Close();
		}

		private void intocbo(string cmd1,string clomnname,string tablename,ComboBox cbo)
		{
			cnserver.ConnectionString=db.connStr;
			cnserver.Open();
			cmd.CommandText=cmd1;
			cmd.Connection=cnserver;
			ad.SelectCommand=cmd;
			dataSet1.Clear();
			try
			{
				ad.Fill(dataSet1,tablename);
				foreach(DataRow dr in dataSet1.Tables[tablename].Rows)
				{
					cbo.Items.Add(dr[clomnname].ToString());
				}
			}
			catch(System.Exception m)
			{MessageBox.Show(m.Message);}
			cnserver.Close();
		}
		

		
		private void Form_xyfb_Load(object sender, System.EventArgs e)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -