📄 form_customer_addorder_selectbook.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 图书管理系统
{
/// <summary>
/// Form_Customer_AddOrder_SelectBook 的摘要说明。
/// </summary>
public class Form_Customer_AddOrder_SelectBook : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button butExit;
private System.Windows.Forms.Button butCommit;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form_Customer_AddOrder_SelectBook()
{
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_Customer_AddOrder_SelectBook));
this.listBox1 = new System.Windows.Forms.ListBox();
this.butExit = new System.Windows.Forms.Button();
this.butCommit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.ItemHeight = 12;
this.listBox1.Location = new System.Drawing.Point(32, 16);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(368, 208);
this.listBox1.TabIndex = 0;
//
// butExit
//
this.butExit.BackColor = System.Drawing.Color.Transparent;
this.butExit.Location = new System.Drawing.Point(252, 248);
this.butExit.Name = "butExit";
this.butExit.Size = new System.Drawing.Size(72, 24);
this.butExit.TabIndex = 27;
this.butExit.Text = "取消";
this.butExit.Click += new System.EventHandler(this.butExit_Click);
//
// butCommit
//
this.butCommit.BackColor = System.Drawing.Color.Transparent;
this.butCommit.Location = new System.Drawing.Point(108, 248);
this.butCommit.Name = "butCommit";
this.butCommit.Size = new System.Drawing.Size(72, 24);
this.butCommit.TabIndex = 26;
this.butCommit.Text = "选择";
this.butCommit.Click += new System.EventHandler(this.butCommit_Click);
//
// Form_Customer_AddOrder_SelectBook
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(432, 286);
this.Controls.Add(this.butExit);
this.Controls.Add(this.butCommit);
this.Controls.Add(this.listBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form_Customer_AddOrder_SelectBook";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "选择图书";
this.Load += new System.EventHandler(this.Form_Customer_AddOrder_SelectBook_Load);
this.ResumeLayout(false);
}
#endregion
SQL sql;
public static string BOOKISBN="";
public static string BOOKNAME="";
public static string BOOKPRICE="";
private void Form_Customer_AddOrder_SelectBook_Load(object sender, System.EventArgs e)
{
sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
sql.ExecuteSQL("select * from 库存信息表 order by bookISBN");
for(int i=0;i<sql.rows.GetLength(0);i++)
listBox1.Items.Add(sql.rows[i,0].ToString());
}
private void butCommit_Click(object sender, System.EventArgs e)
{
if(listBox1.SelectedIndex!=-1)
{
BOOKISBN=sql.rows[listBox1.SelectedIndex,0].ToString();
BOOKNAME=sql.rows[listBox1.SelectedIndex,1].ToString();
BOOKPRICE=sql.rows[listBox1.SelectedIndex,5].ToString();
}
this.Close();
}
private void butExit_Click(object sender, System.EventArgs e)
{
BOOKISBN="";
BOOKNAME="";
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -