?? formemplist.cs
字號:
using System;
using System.Drawing;
using System.Data ;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data .SqlClient ;
namespace BlueHill.BlueHillWindows.DepartmentManagement
{
/// <summary>
/// FormEmpList 的摘要說明。
/// </summary>
public class FormEmpList : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGrid employeedG;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btncel;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public SqlConnection conn=null;
public SqlDataAdapter adp=null;
public DataSet ds=null;
public string managerID="";
public FormEmpList()
{
//
// 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.btncel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.employeedG = new System.Windows.Forms.DataGrid();
this.btnOK = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.employeedG)).BeginInit();
this.SuspendLayout();
//
// btncel
//
this.btncel.Location = new System.Drawing.Point(360, 288);
this.btncel.Name = "btncel";
this.btncel.Size = new System.Drawing.Size(72, 23);
this.btncel.TabIndex = 7;
this.btncel.Text = "取消";
this.btncel.Click += new System.EventHandler(this.btncel_Click);
//
// 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(8, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 16);
this.label1.TabIndex = 6;
this.label1.Text = "請選擇經理";
//
// employeedG
//
this.employeedG.CaptionText = "員工信息";
this.employeedG.DataMember = "";
this.employeedG.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.employeedG.Location = new System.Drawing.Point(8, 48);
this.employeedG.Name = "employeedG";
this.employeedG.Size = new System.Drawing.Size(480, 224);
this.employeedG.TabIndex = 5;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(56, 288);
this.btnOK.Name = "btnOK";
this.btnOK.TabIndex = 4;
this.btnOK.Text = "確定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// FormEmpList
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(496, 317);
this.Controls.Add(this.btncel);
this.Controls.Add(this.label1);
this.Controls.Add(this.employeedG);
this.Controls.Add(this.btnOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "FormEmpList";
this.Text = "員工信息";
this.Load += new System.EventHandler(this.FormEmpList_Load);
((System.ComponentModel.ISupportInitialize)(this.employeedG)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void FormEmpList_Load(object sender, System.EventArgs e)
{
conn=new SqlConnection("integrated security=SSPI;data source=(local);initial catalog=BlueHill");
adp=new SqlDataAdapter("select * from tblEmployee",conn);
ds=new DataSet();
adp.Fill(ds,"tblEmployee");
DataTable dt=ds.Tables["tblEmployee"];
employeedG.DataSource=dt;
}
private void btnOK_Click(object sender, System.EventArgs e)
{
managerID=ds.Tables[0].Rows[employeedG.CurrentRowIndex] ["EmployeeID"].ToString();
this.Close();
}
private void btncel_Click(object sender, System.EventArgs e)
{
this.Close ();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -