//成绩快速浏览:txt=>change事件 private void TxtScore_TextChanged(object sender, EventArgs e) { if (this.dgvScoreList.RowCount == 0) { return; } if (this.txtScore.Text.Trim().Length == 0) { return; } if (!DataValidate.IsInteger(this.txtScore.Text.Trim())) { this.txtScore.Text = ""; this.txtScore.SelectAll(); MessageBox.Show("成绩只能为整数!", "提示信息"); return; } this.cboClass.SelectedIndex = -1; var item = this.txtScore.Text.Trim(); int score = Convert.ToInt32(item); if (score > 100 || score < 0) { this.txtScore.Text = ""; this.txtScore.SelectAll(); MessageBox.Show("成绩只能在0-100之间!", "提示信息"); return; } this.da.Tables[0].DefaultView.RowFilter = "CSharp>" + this.txtScore.Text.Trim(); }
private void BtnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("请输入学员学号", "提示信息"); return; } if (!DataValidate.IsInteger(this.txtStudentId.Text.Trim())) { MessageBox.Show("学号必须为整数!", "提示信息"); this.txtStudentId.Focus(); this.txtStudentId.SelectAll(); return; } int studentId = Convert.ToInt32(this.txtStudentId.Text.Trim()); var studentInfo = studentService.GetStudebntByStudentId(studentId); if (studentInfo == null) { MessageBox.Show("学员学号错误,暂无此学员!", "提示信息"); return; } if (frmStudentInfo == null) { frmStudentInfo = new FrmStudentInfo(studentInfo); frmStudentInfo.ShowDialog(); } else { frmStudentInfo.Activate(); frmStudentInfo.WindowState = FormWindowState.Normal; } }
private void txtScore_TextChanged(object sender, EventArgs e) { if (ds == null || this.txtScore.Text.Trim().Length == 0) { return; } if (!DataValidate.IsInteger(this.txtScore.Text.Trim())) { return; } else { this.ds.Tables[0].DefaultView.RowFilter = "CSharp >" + this.txtScore.Text.Trim(); } }