?? selectsubject.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 財務管理系統
{
/// <summary>
/// SelectSubject 的摘要說明。
public class SelectSubject : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private 財務管理系統.DataSet1 dataSet11;
private System.Data.SqlClient.SqlConnection sqlConnection1;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public SelectSubject()
{
//
// 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()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataSet11 = new 財務管理系統.DataSet1();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "科目表";
this.dataGrid1.DataSource = this.dataSet11;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 0);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(552, 408);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.DoubleClick += new System.EventHandler(this.dataGrid1_DoubleClick);
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "科目表", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("科目代碼", "科目代碼"),
new System.Data.Common.DataColumnMapping("科目名稱", "科目名稱"),
new System.Data.Common.DataColumnMapping("助記碼", "助記碼"),
new System.Data.Common.DataColumnMapping("科目類別", "科目類別"),
new System.Data.Common.DataColumnMapping("是否存貨科目", "是否存貨科目"),
new System.Data.Common.DataColumnMapping("余額方向", "余額方向"),
new System.Data.Common.DataColumnMapping("數量單位", "數量單位")})});
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 科目代碼, 科目名稱, 助記碼, 科目類別, 是否存貨科目, 余額方向, 數量單位 FROM 科目表";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=localhost;packet size=4096;integrated security=SSPI;initial catalo" +
"g=caiwubook;persist security info=False";
//
// SelectSubject
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(552, 405);
this.Controls.Add(this.dataGrid1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "SelectSubject";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "雙擊表格前導航條選擇科目";
this.Load += new System.EventHandler(this.SelectSubject_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void SelectSubject_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(dataSet11);
}
private void dataGrid1_DoubleClick(object sender, System.EventArgs e)
{
//向憑證輸入窗體傳遞選擇的科目編碼和名稱
WarrentInput.mID=dataGrid1[dataGrid1.CurrentCell.RowNumber,0].ToString();
WarrentInput.mName=dataGrid1[dataGrid1.CurrentCell.RowNumber,1].ToString();
this.Close();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -