public static Patients patients = new Patients();//对应表的实体(Model)对象 private void btnSelect_Click(object sender, EventArgs e) { patients.subject_id = txtsubject_id.Text.Trim();//把控件中的值,赋给实体对象的属 patients.gender = txtgender.Text; patients.age = txtage.Text; patients.ethnicity = txtethnicity.Text; patients.expire_flag = txtexpire_flag.Text; patients.admittime = txtadmittime.Text; patients.hospital_expire_flag = txthospital_expire_flag.Text; patients.diagnosis = txtdiagnosis.Text; patients.has_chartevents_data = txthas_chartevents_data.Text; FrmPatientsSelect_Search Select_Search = new FrmPatientsSelect_Search();//实例化子窗体 OpenForm(Select_Search); }
/// <summary> /// 学号控件的键盘事件,用户查询学生信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtstu_no_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Return) //判断用户按下的是不是回车键 { patients.subject_id = txtsubject_id.Text.Trim(); //把控件中的值,赋给实体对象的属 patients.gender = txtgender.Text; patients.age = txtage.Text; patients.ethnicity = txtethnicity.Text; patients.expire_flag = txtexpire_flag.Text; patients.admittime = txtadmittime.Text; patients.hospital_expire_flag = txthospital_expire_flag.Text; patients.diagnosis = txtdiagnosis.Text; patients.has_chartevents_data = txthas_chartevents_data.Text; FrmPatientsSelect_Search Select_Search = new FrmPatientsSelect_Search();//实例化子窗体 OpenForm(Select_Search); } }