private void AddStudentByProc_Load(object sender, EventArgs e) { List <Grade> gradeList = new GradeBLL().GetAllGrades(); this.cboGarde.DataSource = gradeList; this.cboGarde.DisplayMember = "GradeName"; this.cboGarde.ValueMember = "GradeId"; if (this.StuId != null) { //查找此StuId的信息 stuExt = new StudentBLL().GetStudentExt(this.StuId); this.tbStuId.Text = stuExt.StuId; this.tbStuName.Text = stuExt.StuName.ToString(); this.tbBronDate.Text = stuExt.StuBornDate.ToShortDateString(); //this.cboGarde.SelectedItem = stuExt.GradeName.ToString(); if (stuExt.StuSex) { this.rbtnMan.Checked = true; } else { this.rbtnWoMan.Checked = true; } } }
private void FrmGetStuByGrade_Load(object sender, EventArgs e) { this.dgvStu.AutoGenerateColumns = false; this.cboGrade.DisplayMember = "GradeName"; this.cboGrade.ValueMember = "GradeId"; try { List <Grade> grades = GradeBLL.GetAllGrade(); //在集合第一个位置中插入请选择项 grades.Insert(0, new Grade(-1, "请选择")); this.cboGrade.DataSource = new BindingList <Grade>(grades); } catch (Exception ex) { MessageBox.Show("绑定年级出现异常:\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void frmAddStudent_Load(object sender, EventArgs e) { try { this.cboGrade.DisplayMember = "GradeName"; this.cboGrade.ValueMember = "GradeId"; this.cboGrade.DataSource = GradeBLL.GetAllGrade(); } catch (Exception ex) { MessageBox.Show("绑定年级列表出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (!IsUpdate) { this.rbtnMan.Checked = true; } else { this.Text = "编辑学生信息"; this.btnSave.Text = "修改"; this.txtNo.Text = Stu.StudentNo; this.txtNo.ReadOnly = true; this.txtNo.ForeColor = Color.Red; this.txtName.Text = Stu.StudentName; this.txtPhone.Text = Stu.Phone; this.txtAddress.Text = Stu.Address; this.txtCPwd.Text = Stu.LoginPwd; this.txtPwd.Text = Stu.LoginPwd; this.txtEmail.Text = Stu.Email; if (Stu.Gender == "男") { this.rbtnMan.Checked = true; } else { this.rbtnWoMan.Checked = true; } this.picBornDate.Value = Stu.BornDate; this.cboGrade.SelectedValue = Stu.Grade.GradeId; } }
public void ShowTreeView() { TreeNode tn = new TreeNode("全部"); List <Grade> grades = null; try { grades = GradeBLL.GetAllGrade(); } catch (Exception ex) { MessageBox.Show("初始化信息出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } foreach (Grade g in grades) { TreeNode tnGrade = new TreeNode(g.GradeName); tnGrade.Tag = g.GradeId; tn.Nodes.Add(tnGrade); } tn.ExpandAll(); this.tvGrade.Nodes.Add(tn); }