public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public struct Employee
{
public string ID;
public string CName;
public int Age;
}
Employee Emp; //實體化結構變數
private void btn_Insert_Click(object sender, EventArgs e)
{
string strMsg;
Emp.ID = txt_ID.Text;
Emp.CName = txt_CName.Text;
Emp.Age = int.Parse(txt_Age.Text);
strMsg = "員工編號:" + Emp.ID + Environment.NewLine +
"中文姓名:" + Emp.CName + Environment.NewLine +
"年齡:" + Emp.Age.ToString() + Environment.NewLine;
MessageBox.Show(this, strMsg, "員工個人資料");
}
}
全站熱搜
留言列表