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

📄 form1.cs

📁 超市运行模拟软件源程序源代码,是一个用c#语言编写的C/S软件,开发环境是VS.NET 2003 登陆时可以看数据库中的姓名和密码,不然无法登陆,具体操作见里面的说明!
💻 CS
📖 第 1 页 / 共 3 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace sqlgood
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button btnprev;
		private System.Windows.Forms.Button btnnext;
		private System.Windows.Forms.Button btnupdata;
		private System.Windows.Forms.TextBox txtid;
		private System.Windows.Forms.TextBox txtnm;
		private System.Windows.Forms.TextBox txtprice;
		private System.Windows.Forms.TextBox txtnum;
		private System.Windows.Forms.Label labid;
		private System.Windows.Forms.Label labnm;
		private System.Windows.Forms.Label labprice;
		private System.Windows.Forms.Label labnum;
		private System.Windows.Forms.Button btnnewout;
		private System.Windows.Forms.Button btnclose;
		private System.Windows.Forms.Button btnnewin;
		private DataGridTableStyle ts = new DataGridTableStyle();
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button btnlast;
		private System.Windows.Forms.Button btnfirst;
		private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
		private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
		private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
		private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
		private System.Data.SqlClient.SqlConnection sqlConnection1;
		private sqlgood.DataSet1 dataSet11;
		private System.Data.SqlClient.SqlCommand sqlCommand1;
		private System.Windows.Forms.Button btnnew;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5;
		public DataRow currRow;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.Button btnxearch;
		private Form frmParent;
		
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1(Form frm1)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			frmParent=frm1;

			//
			// 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.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.dataSet11 = new sqlgood.DataSet1();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.labnum = new System.Windows.Forms.Label();
			this.labprice = new System.Windows.Forms.Label();
			this.labnm = new System.Windows.Forms.Label();
			this.labid = new System.Windows.Forms.Label();
			this.txtnum = new System.Windows.Forms.TextBox();
			this.txtprice = new System.Windows.Forms.TextBox();
			this.txtnm = new System.Windows.Forms.TextBox();
			this.txtid = new System.Windows.Forms.TextBox();
			this.btnprev = new System.Windows.Forms.Button();
			this.btnnext = new System.Windows.Forms.Button();
			this.btnupdata = new System.Windows.Forms.Button();
			this.btnnewout = new System.Windows.Forms.Button();
			this.btnclose = new System.Windows.Forms.Button();
			this.btnnewin = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.btnlast = new System.Windows.Forms.Button();
			this.btnfirst = new System.Windows.Forms.Button();
			this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
			this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
			this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlCommand1 = new System.Data.SqlClient.SqlCommand();
			this.btnnew = new System.Windows.Forms.Button();
			this.label2 = new System.Windows.Forms.Label();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.btnxearch = new System.Windows.Forms.Button();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.label3 = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// dataGrid1
			// 
			this.dataGrid1.AlternatingBackColor = System.Drawing.Color.Silver;
			this.dataGrid1.BackColor = System.Drawing.Color.White;
			this.dataGrid1.BackgroundColor = System.Drawing.Color.Gainsboro;
			this.dataGrid1.CaptionBackColor = System.Drawing.Color.Maroon;
			this.dataGrid1.CaptionFont = new System.Drawing.Font("Tahoma", 8F);
			this.dataGrid1.CaptionForeColor = System.Drawing.Color.White;
			this.dataGrid1.CaptionText = "商品列表";
			this.dataGrid1.DataMember = "";
			this.dataGrid1.DataSource = this.dataSet11.good;
			this.dataGrid1.Enabled = false;
			this.dataGrid1.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dataGrid1.ForeColor = System.Drawing.Color.Black;
			this.dataGrid1.GridLineColor = System.Drawing.Color.Silver;
			this.dataGrid1.HeaderBackColor = System.Drawing.Color.Silver;
			this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F);
			this.dataGrid1.HeaderForeColor = System.Drawing.Color.Black;
			this.dataGrid1.LinkColor = System.Drawing.Color.Maroon;
			this.dataGrid1.Location = new System.Drawing.Point(0, 56);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.Silver;
			this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.Black;
			this.dataGrid1.SelectionBackColor = System.Drawing.Color.Maroon;
			this.dataGrid1.SelectionForeColor = System.Drawing.Color.White;
			this.dataGrid1.Size = new System.Drawing.Size(344, 256);
			this.dataGrid1.TabIndex = 0;
			this.dataGrid1.Navigate += new System.Windows.Forms.NavigateEventHandler(this.dataGrid1_Navigate);
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.labnum);
			this.groupBox1.Controls.Add(this.labprice);
			this.groupBox1.Controls.Add(this.labnm);
			this.groupBox1.Controls.Add(this.labid);
			this.groupBox1.Controls.Add(this.txtnum);
			this.groupBox1.Controls.Add(this.txtprice);
			this.groupBox1.Controls.Add(this.txtnm);
			this.groupBox1.Controls.Add(this.txtid);
			this.groupBox1.ForeColor = System.Drawing.Color.Blue;
			this.groupBox1.Location = new System.Drawing.Point(448, 24);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(200, 184);
			this.groupBox1.TabIndex = 1;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "商品信息栏";
			// 
			// labnum
			// 
			this.labnum.Location = new System.Drawing.Point(32, 135);
			this.labnum.Name = "labnum";
			this.labnum.Size = new System.Drawing.Size(56, 23);
			this.labnum.TabIndex = 7;
			this.labnum.Text = "数量";
			this.labnum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// labprice
			// 
			this.labprice.Location = new System.Drawing.Point(32, 98);
			this.labprice.Name = "labprice";
			this.labprice.Size = new System.Drawing.Size(56, 23);
			this.labprice.TabIndex = 6;
			this.labprice.Text = "单价";
			this.labprice.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// labnm
			// 
			this.labnm.Location = new System.Drawing.Point(32, 61);
			this.labnm.Name = "labnm";
			this.labnm.Size = new System.Drawing.Size(56, 23);
			this.labnm.TabIndex = 5;
			this.labnm.Text = "名称";
			this.labnm.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// labid
			// 
			this.labid.Location = new System.Drawing.Point(32, 24);
			this.labid.Name = "labid";
			this.labid.Size = new System.Drawing.Size(56, 23);
			this.labid.TabIndex = 4;
			this.labid.Text = "编号";
			this.labid.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// txtnum
			// 
			this.txtnum.Location = new System.Drawing.Point(88, 135);
			this.txtnum.Name = "txtnum";
			this.txtnum.TabIndex = 3;
			this.txtnum.Text = "";
			// 
			// txtprice
			// 
			this.txtprice.Location = new System.Drawing.Point(88, 98);
			this.txtprice.Name = "txtprice";
			this.txtprice.TabIndex = 2;
			this.txtprice.Text = "";
			// 
			// txtnm
			// 
			this.txtnm.Location = new System.Drawing.Point(88, 61);
			this.txtnm.Name = "txtnm";
			this.txtnm.TabIndex = 1;
			this.txtnm.Text = "";
			// 
			// txtid
			// 
			this.txtid.Location = new System.Drawing.Point(88, 24);
			this.txtid.Name = "txtid";
			this.txtid.TabIndex = 0;
			this.txtid.Text = "";
			// 
			// btnprev
			// 
			this.btnprev.Location = new System.Drawing.Point(344, 80);
			this.btnprev.Name = "btnprev";
			this.btnprev.Size = new System.Drawing.Size(72, 23);
			this.btnprev.TabIndex = 2;
			this.btnprev.Text = "向上";
			this.btnprev.Click += new System.EventHandler(this.btnprev_Click);
			// 
			// btnnext

⌨️ 快捷键说明

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