コード例 #1
0
        private void ButtonEditStudent_Click(object sender, EventArgs e)
        {
            if (DataViewGrid.SelectedCells.Count == 0)
            {
                return;
            }
            var F       = new StudentAddForm(this);
            var Index   = DataViewGrid.SelectedCells[0].RowIndex;
            var Student = Students[Index];

            F.SetData(Student);
            var DR = F.ShowDialog();

            if (DR == DialogResult.OK)
            {
                var S = F.GetStudent();
                Students[Index] = S;
                //MessageBox.Show(StudentsViewGrid.DataSource.ToString());
                ((List <Student>)DataViewGrid.DataSource)[Index] = S;

                //StudentsViewGrid.E

                SetDataSource(Students);
            }
        }
コード例 #2
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            var StudentAddForm = new StudentAddForm(this);
            var Result         = StudentAddForm.ShowDialog();

            if (Result == DialogResult.OK)
            {
                int ID      = Students.Count + 1;
                var Student = StudentAddForm.GetStudent();
                Student.ID = ID;
                Students.Add(Student);
                SetDataSource(Students);
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: unlight/StudentStudio
        private void ButtonEditStudent_Click(object sender, EventArgs e)
        {
            if (DataViewGrid.SelectedCells.Count == 0) {
                return;
            }
            var F = new StudentAddForm(this);
            var Index = DataViewGrid.SelectedCells[0].RowIndex;
            var Student = Students[Index];
            F.SetData(Student);
            var DR = F.ShowDialog();
            if (DR == DialogResult.OK)
            {
                var S = F.GetStudent();
                Students[Index] = S;
                //MessageBox.Show(StudentsViewGrid.DataSource.ToString());
                ((List<Student>)DataViewGrid.DataSource)[Index] = S;

                //StudentsViewGrid.E

                SetDataSource(Students);
            }
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: unlight/StudentStudio
 private void AddButton_Click(object sender, EventArgs e)
 {
     var StudentAddForm = new StudentAddForm(this);
     var Result = StudentAddForm.ShowDialog();
     if (Result == DialogResult.OK)
     {
         int ID = Students.Count + 1;
         var Student = StudentAddForm.GetStudent();
         Student.ID = ID;
         Students.Add(Student);
         SetDataSource(Students);
     }
 }