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

📄 frmtongxin.cs

📁 毕业生管理系统:分为六个模块:身份验证模块、毕业生资料模块,考试成绩录入模块、通信录及数据输出与系统设置模块、毕业生成绩统计模块、数据库维护模块。
💻 CS
📖 第 1 页 / 共 3 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;

namespace 毕业生信息管理系统
{
	/// <summary>
	/// frmscore 的摘要说明。
	/// </summary>
	public class frmTongxin : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Button btnClose;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private OleDbDataAdapter objSqlDataAdapter;
		private OleDbConnection objSqlConn;
		private DataSet objDataSet;
		private System.Windows.Forms.DataGrid dbgBooksDt;
		private System.Windows.Forms.Button btnPrint;
		private System.Windows.Forms.Button btnPrintPrev;
		private System.Windows.Forms.Button btnSetup;
		private OleDbParameter objParam;
		private System.Drawing.Printing.PrintDocument pdocOrderDetails;
		private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
		private System.Windows.Forms.PrintPreviewDialog printPreviewDialog1;
		private System.Windows.Forms.PrintDialog printDialog1;
		private OleDbDataReader objOleDbDataReader;
		private OleDbCommand objOleDbCommand;
		private string updCmd;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.TextBox txtEmail;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtAdd;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button btnDel;
		private System.Windows.Forms.Button btnUpdata;
		private System.Windows.Forms.Button btnIns;
		private System.Windows.Forms.TextBox txtYouzheng;
		private System.Windows.Forms.TextBox txtTel;
		private System.Windows.Forms.TextBox txtQQ;
		private System.Windows.Forms.TextBox txtJiguan;
		private System.Windows.Forms.TextBox txtAge;
		private System.Windows.Forms.TextBox txtname;
		private System.Windows.Forms.Label lblNo4;
		private System.Windows.Forms.Label lblNo3;
		private System.Windows.Forms.Label lblNo2;
		private System.Windows.Forms.Label lblNo1;
		private System.Windows.Forms.Label lblpassword;
		private System.Windows.Forms.Label lblname;
		private System.Windows.Forms.Button btnAgain;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox textBox1;
		private string delCmd;
		
		public frmTongxin()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}
		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		private bool ValidateFields()
		{
			bool returnValue=true;
			if(this.txtname.Text.Trim()==string.Empty)
			{
				MessageBox.Show("提供完整的详细信息");
				this.txtname.Focus();
				return false;
			}
			else
			{
				for(int i=0;i<this.txtAge.Text.Length;i++)
				{
					if(!Char.IsNumber(txtAge.Text.ToString(),i))
					{
						MessageBox.Show("年龄应为数字!");
						txtAge.Focus();
						returnValue=false;
						break;
					}
				}
				for(int i=0;i<this.txtJiguan.Text.Length;i++)
				{
					if(Char.IsNumber(txtJiguan.Text.ToString(),i))
					{
						MessageBox.Show("请正确输入籍贯名称!");
						txtJiguan.Focus();
						returnValue=false;
						break;
					}
				}
				for(int i=0;i<this.txtQQ.Text.Length;i++)
				{
					if(!Char.IsNumber(txtQQ.Text.ToString(),i))
					{
						MessageBox.Show("QQ号码应为数字");
						txtQQ.Focus();
						returnValue=false;
						break;
					}
				}
				for(int i=0;i<this.txtTel.Text.Length;i++)
				{
					if(!Char.IsNumber(txtTel.Text.ToString(),i))
					{
						MessageBox.Show("联系电话应该为数字!");
						txtTel.Focus();
						returnValue=false;
						break;
					}
				}
				for(int i=0;i<this.txtYouzheng.Text.Length;i++)
				{
					if(!Char.IsNumber(txtYouzheng.Text.ToString(),i))
					{
						MessageBox.Show("邮政编码应该为数字!");
						txtYouzheng.Focus();
						returnValue=false;
						break;
					}
				}
				for(int i=0;i<this.txtEmail.Text.Length;i++)
				{
					if(txtEmail.Text == ""|| txtEmail.Text.IndexOf("@") < 0||txtEmail.Text.IndexOf("@")>txtEmail.Text.IndexOf("."))
					{
						MessageBox.Show("Email输入错误或者格式错误!");
						MessageBox.Show("邮政编码应该为数字!");
						txtEmail.Focus();
						returnValue=false;
						break;
					}
				}

				for(int i=0;i<this.txtAdd.Text.Length;i++)
				{
					if(txtAdd.Text == "")
					{
						MessageBox.Show("请输入正确的地址信息");
						txtYouzheng.Focus();
						returnValue=false;
						break;
					}
				}

				return returnValue;
			}
		}
		
		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(frmTongxin));
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.btnSetup = new System.Windows.Forms.Button();
			this.btnClose = new System.Windows.Forms.Button();
			this.btnPrint = new System.Windows.Forms.Button();
			this.btnPrintPrev = new System.Windows.Forms.Button();
			this.dbgBooksDt = new System.Windows.Forms.DataGrid();
			this.pdocOrderDetails = new System.Drawing.Printing.PrintDocument();
			this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
			this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
			this.printDialog1 = new System.Windows.Forms.PrintDialog();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.btnAgain = new System.Windows.Forms.Button();
			this.txtEmail = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.txtAdd = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.btnDel = new System.Windows.Forms.Button();
			this.btnUpdata = new System.Windows.Forms.Button();
			this.btnIns = new System.Windows.Forms.Button();
			this.txtYouzheng = new System.Windows.Forms.TextBox();
			this.txtTel = new System.Windows.Forms.TextBox();
			this.txtQQ = new System.Windows.Forms.TextBox();
			this.txtJiguan = new System.Windows.Forms.TextBox();
			this.txtAge = new System.Windows.Forms.TextBox();
			this.txtname = new System.Windows.Forms.TextBox();
			this.lblNo4 = new System.Windows.Forms.Label();
			this.lblNo3 = new System.Windows.Forms.Label();
			this.lblNo2 = new System.Windows.Forms.Label();
			this.lblNo1 = new System.Windows.Forms.Label();
			this.lblpassword = new System.Windows.Forms.Label();
			this.lblname = new System.Windows.Forms.Label();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dbgBooksDt)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox2
			// 
			this.groupBox2.BackColor = System.Drawing.SystemColors.Desktop;
			this.groupBox2.Controls.Add(this.groupBox3);
			this.groupBox2.Controls.Add(this.btnSetup);
			this.groupBox2.Controls.Add(this.btnClose);
			this.groupBox2.Controls.Add(this.btnPrint);
			this.groupBox2.Controls.Add(this.btnPrintPrev);
			this.groupBox2.Controls.Add(this.dbgBooksDt);
			this.groupBox2.Font = new System.Drawing.Font("黑体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.groupBox2.ForeColor = System.Drawing.Color.Blue;
			this.groupBox2.Location = new System.Drawing.Point(352, 16);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(416, 272);
			this.groupBox2.TabIndex = 1;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "显示";
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.textBox1);
			this.groupBox3.Controls.Add(this.label4);
			this.groupBox3.Controls.Add(this.label3);
			this.groupBox3.Controls.Add(this.comboBox1);
			this.groupBox3.Location = new System.Drawing.Point(8, 16);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(400, 48);
			this.groupBox3.TabIndex = 5;
			this.groupBox3.TabStop = false;
			// 
			// textBox1
			// 
			this.textBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.textBox1.ForeColor = System.Drawing.Color.Blue;
			this.textBox1.Location = new System.Drawing.Point(264, 17);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(128, 21);
			this.textBox1.TabIndex = 3;
			this.textBox1.Text = "";
			this.textBox1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyUp);
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.ForeColor = System.Drawing.Color.DarkOrchid;
			this.label4.Location = new System.Drawing.Point(200, 17);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(64, 24);
			this.label4.TabIndex = 2;
			this.label4.Text = "请输入:";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.ForeColor = System.Drawing.Color.DarkOrchid;
			this.label3.Location = new System.Drawing.Point(8, 17);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 24);
			this.label3.TabIndex = 1;
			this.label3.Text = "查询:";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// comboBox1
			// 
			this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.comboBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.comboBox1.ForeColor = System.Drawing.Color.Blue;
			this.comboBox1.Items.AddRange(new object[] {
														   "",
														   "按姓名查询",
														   "按年龄查询",
														   "按籍贯查询",
														   "按邮政编码"});
			this.comboBox1.Location = new System.Drawing.Point(56, 16);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(128, 20);
			this.comboBox1.TabIndex = 0;
			// 
			// btnSetup
			// 
			this.btnSetup.Font = new System.Drawing.Font("黑体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnSetup.ForeColor = System.Drawing.Color.Magenta;
			this.btnSetup.Location = new System.Drawing.Point(120, 240);
			this.btnSetup.Name = "btnSetup";
			this.btnSetup.Size = new System.Drawing.Size(80, 24);
			this.btnSetup.TabIndex = 4;
			this.btnSetup.Text = "打印设置";
			this.btnSetup.Click += new System.EventHandler(this.btnSetup_Click_1);
			// 
			// btnClose
			// 
			this.btnClose.Font = new System.Drawing.Font("黑体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnClose.ForeColor = System.Drawing.Color.Magenta;
			this.btnClose.Location = new System.Drawing.Point(328, 240);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(80, 24);
			this.btnClose.TabIndex = 3;
			this.btnClose.Text = "退出(&E)";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnPrint
			// 
			this.btnPrint.Font = new System.Drawing.Font("黑体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnPrint.ForeColor = System.Drawing.Color.Magenta;
			this.btnPrint.Location = new System.Drawing.Point(224, 240);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new System.Drawing.Size(88, 24);
			this.btnPrint.TabIndex = 2;
			this.btnPrint.Text = "打印(&P)";
			this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
			// 
			// btnPrintPrev
			// 
			this.btnPrintPrev.Font = new System.Drawing.Font("黑体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnPrintPrev.ForeColor = System.Drawing.Color.Magenta;
			this.btnPrintPrev.Location = new System.Drawing.Point(16, 240);
			this.btnPrintPrev.Name = "btnPrintPrev";
			this.btnPrintPrev.Size = new System.Drawing.Size(80, 24);
			this.btnPrintPrev.TabIndex = 1;
			this.btnPrintPrev.Text = "打印预览";
			this.btnPrintPrev.Click += new System.EventHandler(this.btnPrintPrev_Click);
			// 
			// dbgBooksDt
			// 
			this.dbgBooksDt.CaptionBackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
			this.dbgBooksDt.DataMember = "";
			this.dbgBooksDt.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.dbgBooksDt.HeaderFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.dbgBooksDt.HeaderForeColor = System.Drawing.SystemColors.ControlText;

⌨️ 快捷键说明

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