📄 goodslistform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using SupDataBase;//命名空间修改
using System.Data.SqlClient; //加进数据库类链接
using System.Data;
namespace WindowsApplication1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Goodlist : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox2;
private SqlConnection m_connection; //和数据库链接
private SqlDataAdapter m_sqlDataAdapter;
private System.Windows.Forms.TextBox m_GoodsCode;
private System.Windows.Forms.TextBox m_GoodsName;
private System.Windows.Forms.TextBox m_SalePrice;
private System.Windows.Forms.TextBox m_PurchasePrice;
private System.Windows.Forms.TextBox m_StockNumber;
private System.Windows.Forms.TextBox m_Unit;
private System.Windows.Forms.TextBox m_Remark;
private System.Windows.Forms.DataGrid m_GoodListdataGrid;//适配器
private int pre_idx;
private System.Data.DataView m_dataview;
private System.Data.DataTable datatable;
private System.Windows.Forms.Button button2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Goodlist()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
m_connection=DBUtil.GetConnection();//获得数据库链接
m_sqlDataAdapter=new SqlDataAdapter();//初始化适配器
pre_idx =-1;
datatable = new System.Data.DataTable();
datatable.Columns.Add(new System.Data.DataColumn("商品ID"));
datatable.Columns.Add(new System.Data.DataColumn("商品条码"));
datatable.Columns.Add(new System.Data.DataColumn("商品名称"));
datatable.Columns.Add(new System.Data.DataColumn("进价"));
datatable.Columns.Add(new System.Data.DataColumn("售价"));
datatable.Columns.Add(new System.Data.DataColumn("商品库存"));
datatable.Columns.Add(new System.Data.DataColumn("计量单位"));
datatable.Columns.Add(new System.Data.DataColumn("备注"));
m_dataview = new System.Data.DataView(datatable);
//
// 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.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.m_Remark = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.m_Unit = new System.Windows.Forms.TextBox();
this.m_StockNumber = new System.Windows.Forms.TextBox();
this.m_GoodsName = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.m_PurchasePrice = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.m_SalePrice = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.m_GoodsCode = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.m_GoodListdataGrid = new System.Windows.Forms.DataGrid();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.m_GoodListdataGrid)).BeginInit();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.m_Remark);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.m_Unit);
this.groupBox1.Controls.Add(this.m_StockNumber);
this.groupBox1.Controls.Add(this.m_GoodsName);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.m_PurchasePrice);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.m_SalePrice);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.m_GoodsCode);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(8, 376);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(736, 128);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "浏览向导";
this.groupBox1.Enter += new System.EventHandler(this.goodview_Enter);
this.groupBox1.TextChanged += new System.EventHandler(this.浏览_Enter);
this.groupBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.groupBox1_Paint);
//
// button1
//
this.button1.Location = new System.Drawing.Point(472, 88);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 24);
this.button1.TabIndex = 16;
this.button1.Text = "修改";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// m_Remark
//
this.m_Remark.Location = new System.Drawing.Point(80, 88);
this.m_Remark.Name = "m_Remark";
this.m_Remark.Size = new System.Drawing.Size(280, 21);
this.m_Remark.TabIndex = 15;
this.m_Remark.Text = "";
//
// label8
//
this.label8.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label8.Location = new System.Drawing.Point(24, 96);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(40, 16);
this.label8.TabIndex = 14;
this.label8.Text = "备注";
//
// label7
//
this.label7.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label7.Location = new System.Drawing.Point(448, 64);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(64, 16);
this.label7.TabIndex = 13;
this.label7.Text = "计量单位";
//
// m_Unit
//
this.m_Unit.Location = new System.Drawing.Point(520, 56);
this.m_Unit.Name = "m_Unit";
this.m_Unit.Size = new System.Drawing.Size(104, 21);
this.m_Unit.TabIndex = 11;
this.m_Unit.Text = "";
//
// m_StockNumber
//
this.m_StockNumber.Location = new System.Drawing.Point(320, 56);
this.m_StockNumber.Name = "m_StockNumber";
this.m_StockNumber.Size = new System.Drawing.Size(104, 21);
this.m_StockNumber.TabIndex = 10;
this.m_StockNumber.Text = "";
//
// m_GoodsName
//
this.m_GoodsName.Location = new System.Drawing.Point(80, 56);
this.m_GoodsName.Name = "m_GoodsName";
this.m_GoodsName.Size = new System.Drawing.Size(144, 21);
this.m_GoodsName.TabIndex = 9;
this.m_GoodsName.Text = "";
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label5.Location = new System.Drawing.Point(240, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 24);
this.label5.TabIndex = 7;
this.label5.Text = "库存数量";
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.Location = new System.Drawing.Point(16, 64);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 24);
this.label4.TabIndex = 6;
this.label4.Text = "商品名称";
//
// m_PurchasePrice
//
this.m_PurchasePrice.Location = new System.Drawing.Point(520, 24);
this.m_PurchasePrice.Name = "m_PurchasePrice";
this.m_PurchasePrice.Size = new System.Drawing.Size(72, 21);
this.m_PurchasePrice.TabIndex = 5;
this.m_PurchasePrice.Text = "";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(448, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 24);
this.label3.TabIndex = 4;
this.label3.Text = "进价";
//
// m_SalePrice
//
this.m_SalePrice.Location = new System.Drawing.Point(320, 24);
this.m_SalePrice.Name = "m_SalePrice";
this.m_SalePrice.Size = new System.Drawing.Size(104, 21);
this.m_SalePrice.TabIndex = 3;
this.m_SalePrice.Text = "";
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label2.Location = new System.Drawing.Point(256, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(40, 24);
this.label2.TabIndex = 2;
this.label2.Text = "售价";
//
// m_GoodsCode
//
this.m_GoodsCode.Location = new System.Drawing.Point(80, 24);
this.m_GoodsCode.Name = "m_GoodsCode";
this.m_GoodsCode.Size = new System.Drawing.Size(144, 21);
this.m_GoodsCode.TabIndex = 1;
this.m_GoodsCode.Text = "";
this.m_GoodsCode.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(16, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 16);
this.label1.TabIndex = 0;
this.label1.Text = "条形码";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.m_GoodListdataGrid);
this.groupBox2.Location = new System.Drawing.Point(8, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(736, 352);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "商品列表";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -