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

📄 form2.cs

📁 超市运行模拟软件源程序源代码,是一个用c#语言编写的C/S软件,开发环境是VS.NET 2003 登陆时可以看数据库中的姓名和密码,不然无法登陆,具体操作见里面的说明!
💻 CS
📖 第 1 页 / 共 2 页
字号:
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>
	/// Form2 的摘要说明。
	/// </summary>
	public class Form2 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button btnupdata;
		private System.Windows.Forms.Button btnclose;
		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 Form frmParent;
		private DataGridTableStyle ts = new DataGridTableStyle();
		private System.Windows.Forms.Label label1;
		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.Windows.Forms.TextBox txtnum3;
		private System.Windows.Forms.TextBox txtprice3;
		private System.Windows.Forms.TextBox txtnm3;
		private System.Windows.Forms.TextBox txtid3;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Button btnout;
		static double outallmoney=0,outallnum=0,outallmoney2=0;
		private System.Windows.Forms.Button btnprev;
		private System.Windows.Forms.Button btnnext;
		private System.Windows.Forms.TextBox txtmoney;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button btnshou;
		private System.Windows.Forms.TextBox txtallnum3;
		private System.Windows.Forms.TextBox txtacount3;
		private System.Windows.Forms.LinkLabel linkLabel1;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form2(Form frm)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
            frmParent=frm;
			//
			// 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.btnupdata = new System.Windows.Forms.Button();
			this.btnclose = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.txtacount3 = new System.Windows.Forms.TextBox();
			this.txtallnum3 = new System.Windows.Forms.TextBox();
			this.button2 = new System.Windows.Forms.Button();
			this.txtmoney = new System.Windows.Forms.TextBox();
			this.btnshou = new System.Windows.Forms.Button();
			this.btnout = new System.Windows.Forms.Button();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.txtnum3 = new System.Windows.Forms.TextBox();
			this.txtprice3 = new System.Windows.Forms.TextBox();
			this.txtnm3 = new System.Windows.Forms.TextBox();
			this.txtid3 = new System.Windows.Forms.TextBox();
			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.label1 = new System.Windows.Forms.Label();
			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.btnprev = new System.Windows.Forms.Button();
			this.btnnext = new System.Windows.Forms.Button();
			this.linkLabel1 = new System.Windows.Forms.LinkLabel();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// dataGrid1
			// 
			this.dataGrid1.AlternatingBackColor = System.Drawing.Color.GhostWhite;
			this.dataGrid1.BackColor = System.Drawing.Color.GhostWhite;
			this.dataGrid1.BackgroundColor = System.Drawing.Color.Lavender;
			this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.dataGrid1.CaptionBackColor = System.Drawing.Color.RoyalBlue;
			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.FlatMode = true;
			this.dataGrid1.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dataGrid1.ForeColor = System.Drawing.Color.MidnightBlue;
			this.dataGrid1.GridLineColor = System.Drawing.Color.RoyalBlue;
			this.dataGrid1.HeaderBackColor = System.Drawing.Color.MidnightBlue;
			this.dataGrid1.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dataGrid1.HeaderForeColor = System.Drawing.Color.Lavender;
			this.dataGrid1.LinkColor = System.Drawing.Color.Teal;
			this.dataGrid1.Location = new System.Drawing.Point(8, 48);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.ParentRowsBackColor = System.Drawing.Color.Lavender;
			this.dataGrid1.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
			this.dataGrid1.SelectionBackColor = System.Drawing.Color.Teal;
			this.dataGrid1.SelectionForeColor = System.Drawing.Color.PaleGreen;
			this.dataGrid1.Size = new System.Drawing.Size(336, 240);
			this.dataGrid1.TabIndex = 0;
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// btnupdata
			// 
			this.btnupdata.Location = new System.Drawing.Point(360, 216);
			this.btnupdata.Name = "btnupdata";
			this.btnupdata.TabIndex = 3;
			this.btnupdata.Text = "保存";
			this.btnupdata.Visible = false;
			this.btnupdata.Click += new System.EventHandler(this.btnupdata_Click);
			// 
			// btnclose
			// 
			this.btnclose.Location = new System.Drawing.Point(712, 320);
			this.btnclose.Name = "btnclose";
			this.btnclose.Size = new System.Drawing.Size(64, 24);
			this.btnclose.TabIndex = 4;
			this.btnclose.Text = "关闭";
			this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.txtacount3);
			this.groupBox1.Controls.Add(this.txtallnum3);
			this.groupBox1.Controls.Add(this.button2);
			this.groupBox1.Controls.Add(this.txtmoney);
			this.groupBox1.Controls.Add(this.btnshou);
			this.groupBox1.Controls.Add(this.btnout);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.txtnum3);
			this.groupBox1.Controls.Add(this.txtprice3);
			this.groupBox1.Controls.Add(this.txtnm3);
			this.groupBox1.Controls.Add(this.txtid3);
			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.ForeColor = System.Drawing.Color.Blue;
			this.groupBox1.Location = new System.Drawing.Point(456, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(216, 368);
			this.groupBox1.TabIndex = 6;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "销售栏";
			// 
			// txtacount3
			// 
			this.txtacount3.Location = new System.Drawing.Point(96, 224);
			this.txtacount3.Name = "txtacount3";
			this.txtacount3.Size = new System.Drawing.Size(104, 21);
			this.txtacount3.TabIndex = 20;
			this.txtacount3.Text = "";
			this.txtacount3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// txtallnum3
			// 
			this.txtallnum3.ForeColor = System.Drawing.Color.Blue;
			this.txtallnum3.Location = new System.Drawing.Point(96, 184);
			this.txtallnum3.Name = "txtallnum3";
			this.txtallnum3.Size = new System.Drawing.Size(104, 21);
			this.txtallnum3.TabIndex = 19;
			this.txtallnum3.TabStop = false;
			this.txtallnum3.Text = "";
			this.txtallnum3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(120, 256);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(75, 32);
			this.button2.TabIndex = 17;
			this.button2.Text = "取消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// txtmoney
			// 
			this.txtmoney.AcceptsReturn = true;
			this.txtmoney.AcceptsTab = true;
			this.txtmoney.Location = new System.Drawing.Point(40, 296);
			this.txtmoney.Name = "txtmoney";
			this.txtmoney.Size = new System.Drawing.Size(144, 21);
			this.txtmoney.TabIndex = 16;
			this.txtmoney.Text = "";
			this.txtmoney.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			this.txtmoney.TextChanged += new System.EventHandler(this.txtmoney_TextChanged);
			// 
			// btnshou
			// 
			this.btnshou.Enabled = false;
			this.btnshou.Location = new System.Drawing.Point(80, 328);
			this.btnshou.Name = "btnshou";
			this.btnshou.Size = new System.Drawing.Size(64, 32);
			this.btnshou.TabIndex = 13;
			this.btnshou.Text = "收银";
			this.btnshou.Click += new System.EventHandler(this.btnshou_Click_1);
			// 
			// btnout
			// 
			this.btnout.Location = new System.Drawing.Point(24, 256);
			this.btnout.Name = "btnout";
			this.btnout.Size = new System.Drawing.Size(75, 32);
			this.btnout.TabIndex = 12;
			this.btnout.Text = "销售";
			this.btnout.Click += new System.EventHandler(this.btnout_Click);
			// 
			// label3
			// 
			this.label3.ForeColor = System.Drawing.Color.Blue;
			this.label3.Location = new System.Drawing.Point(24, 224);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(72, 23);
			this.label3.TabIndex = 10;
			this.label3.Text = "销售总价格";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// label2
			// 
			this.label2.ForeColor = System.Drawing.Color.Blue;
			this.label2.Location = new System.Drawing.Point(24, 184);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 23);
			this.label2.TabIndex = 8;
			this.label2.Text = "销售总数量";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// txtnum3
			// 
			this.txtnum3.AcceptsReturn = true;
			this.txtnum3.AcceptsTab = true;
			this.txtnum3.Location = new System.Drawing.Point(80, 144);
			this.txtnum3.Name = "txtnum3";
			this.txtnum3.TabIndex = 7;
			this.txtnum3.Text = "";
			this.txtnum3.TextChanged += new System.EventHandler(this.txtnum3_TextChanged);
			// 
			// txtprice3
			// 
			this.txtprice3.AcceptsReturn = true;
			this.txtprice3.AcceptsTab = true;
			this.txtprice3.Location = new System.Drawing.Point(80, 104);
			this.txtprice3.Name = "txtprice3";
			this.txtprice3.TabIndex = 6;
			this.txtprice3.Text = "";
			// 
			// txtnm3
			// 
			this.txtnm3.AcceptsReturn = true;
			this.txtnm3.AcceptsTab = true;
			this.txtnm3.Location = new System.Drawing.Point(80, 64);
			this.txtnm3.Name = "txtnm3";
			this.txtnm3.TabIndex = 5;
			this.txtnm3.Text = "";
			// 
			// txtid3
			// 
			this.txtid3.AcceptsReturn = true;
			this.txtid3.AcceptsTab = true;
			this.txtid3.Location = new System.Drawing.Point(80, 24);
			this.txtid3.Name = "txtid3";
			this.txtid3.TabIndex = 4;
			this.txtid3.Text = "";
			this.txtid3.TextChanged += new System.EventHandler(this.txtid3_TextChanged);
			// 
			// labnum
			// 
			this.labnum.Location = new System.Drawing.Point(24, 144);
			this.labnum.Name = "labnum";
			this.labnum.Size = new System.Drawing.Size(56, 23);
			this.labnum.TabIndex = 3;
			this.labnum.Text = "数量";
			this.labnum.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// labprice
			// 
			this.labprice.Location = new System.Drawing.Point(24, 98);
			this.labprice.Name = "labprice";
			this.labprice.Size = new System.Drawing.Size(56, 23);
			this.labprice.TabIndex = 2;
			this.labprice.Text = "单价";
			this.labprice.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// labnm
			// 
			this.labnm.Location = new System.Drawing.Point(24, 61);
			this.labnm.Name = "labnm";
			this.labnm.Size = new System.Drawing.Size(56, 23);
			this.labnm.TabIndex = 1;
			this.labnm.Text = "名称";
			this.labnm.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// labid
			// 
			this.labid.Location = new System.Drawing.Point(24, 24);
			this.labid.Name = "labid";
			this.labid.Size = new System.Drawing.Size(56, 23);
			this.labid.TabIndex = 0;
			this.labid.Text = "编号";
			this.labid.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.ForeColor = System.Drawing.Color.Blue;
			this.label1.Location = new System.Drawing.Point(80, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(144, 23);
			this.label1.TabIndex = 7;
			this.label1.Text = "销 售 版 面";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// sqlDataAdapter1
			// 
			this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
			this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
			this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "good", new System.Data.Common.DataColumnMapping[] {
																																																			  new System.Data.Common.DataColumnMapping("goodid", "goodid"),
																																																			  new System.Data.Common.DataColumnMapping("goodnm", "goodnm"),
																																																			  new System.Data.Common.DataColumnMapping("goodprice", "goodprice"),
																																																			  new System.Data.Common.DataColumnMapping("goodnum", "goodnum")})});
			this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1

⌨️ 快捷键说明

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