private void button1_Click(object sender, EventArgs e) { int год; if (string.IsNullOrEmpty(textBox5.Text)) { MessageBox.Show("Не введено название группы"); textBox5.Focus(); return; } if (string.IsNullOrEmpty(comboBox1.Text)) { MessageBox.Show("Не выбран факультет"); comboBox1.Focus(); return; } if (!int.TryParse(textBox1.Text, out год)) { MessageBox.Show("Год должен быть задан числом"); textBox1.Focus(); return; } if (string.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("Не задан староста"); textBox2.Focus(); return; } if (string.IsNullOrEmpty(textBox4.Text)) { MessageBox.Show("Не задана почта группы"); textBox4.Focus(); return; } Form1.lstG.Add(new Учебная_группа(textBox5.Text, год, comboBox1.Text, textBox2.Text, textBox4.Text, lst)); add = true; _24_04_GroupStudentDataSet.GroupsRow row = _24_04_GroupStudentDataSet.Groups.NewGroupsRow(); row.Gr_Name = textBox5.Text; row.Gr_Year = int.Parse(textBox1.Text); row.Gr_Faculty = comboBox1.Text; row.Gr_mail = textBox4.Text; row.Gr_Starosta = textBox2.Text; _24_04_GroupStudentDataSet.Groups.Rows.Add(row); MessageBox.Show("Группа добавлена"); form1.учебнаягруппаBindingSource.ResetBindings(false); form1.Filter(); }
private void button8_Click(object sender, EventArgs e) { int ids = (int)groupsDataGridView.CurrentRow.Cells[0].Value; rowg = GroupStudentDataSet.Groups.FindByGroup_ID(ids); rowg.Gr_Name = textBox10.Text; rowg.Gr_Year = short.Parse(textBox11.Text); rowg.Gr_Faculty = textBox12.Text; rowg.Gr_Starosta = textBox13.Text; rowg.Gr_mail = textBox14.Text; groupsBindingSource.EndEdit(); groupsTableAdapter.Update(GroupStudentDataSet.Groups); }