private ScoreMsg GetScore() { ScoreMsg score = new ScoreMsg(); Debug.WriteLine(RegularExpressions.IsNumeric(tbScore.Text)); if (tbStuName.Text.Equals("") || tbCourseName.Text.Equals("") || tbScore.Text.Equals("")) { MessageBox.Show("请确保输入数据正确", "错误", MessageBoxButtons.OK); return(null); } else { score.CourseId = Convert.ToInt32(tbCourseNo.Text); score.StudentNo = Convert.ToInt32(tbStuNo.Text); score.Score = Convert.ToInt32(tbScore.Text); } return(score); }