设置父窗体代码 :private void tsmStudentsInfo_Click(object sender, EventArgs e)
        {
            FrmStudentInfo frm = new FrmStudentInfo();
            //frm.MdiParent = this;
            frm.Show();
        }
主要代码 :
 public partial class FrmStudentInfo : Form
    {
        public FrmStudentInfo()
        {
            InitializeComponent();
        }        private void FrmStudentInfo_Load(object sender, EventArgs e)
        {
            this.DGV.AutoGenerateColumns = false;  //设置不让系统自动生成列
            BindStudents();  //绑定数据方法
        }        StudentManager studentManager = new StudentManager();        /// <summary>
        /// 绑定DGV表中的学生信息
        /// </summary>
        public void BindStudents()
        {
            try
            {
                List<Students> list = studentManager.GetAllStudetns();
                this.DGV.DataSource = list;  //绑定数据
                //当得到的集合不为空时,设置年级名称信息
                if (list != null)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        //循环绑定第5列的值
                        this.DGV.Rows[i].Cells[4].Value = GetGradeNameByGradeNo(list[i].GradeNo);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            
        }        /// <summary>
        /// 通过年级编号查询年级名称
        /// </summary>
        /// <param name="gradeNo">年级编号</param>
        /// <returns>返回年级名称</returns>
        public string GetGradeNameByGradeNo(int gradeNo)
        {
            GradeManager gradeManager = new GradeManager();
            //定义年级名称
            string gradeName = "";
            try
            {
                List<Grade> GradeList = gradeManager.GetAllGrade();                if (GradeList != null)
                {
                    //循环判断传过来的年级编号与集合的的编号,得到相等时的年级名称
                    for (int i = 0; i < GradeList.Count; i++)
                    {
                        if (GradeList[i].GradeNo == gradeNo)
                        {
                            gradeName = GradeList[i].GradeName;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }            return gradeName;
        }