//Метод отправки измененных данных private void editMedicamentData_Click(object sender, EventArgs e) { if (checkTextBox()) { if (!_edit) { editMedicament.Update(medicamentNameTextBox.Text, withRecipeYes.Checked, categoryNameTextBox.Text, dateProducingTextBox.Text, dateStorageLifeTextBox.Text, Convert.ToDecimal(priceTextBox.Text), brandNameTextBox.Text, countryNameTextBox.Text, descriptionTextBox.Text); BaseMedicament medicament = new BaseMedicament(editMedicament.MedicamentId); MedicamentDescription medicamentDescription = new MedicamentDescription(medicament); medicamentDescription.TopLevel = false; medicamentDescription.Dock = DockStyle.Fill; medicamentDescription.FormBorderStyle = FormBorderStyle.None; //Вычисляю панель subMenuPanel, которая является родительской для текущей формы Panel subMenuPanel = (Panel)this.Parent; foreach (Control control in subMenuPanel.Controls) { control.Dispose(); } subMenuPanel.Controls.Add(medicamentDescription); subMenuPanel.Tag = medicamentDescription; medicamentDescription.BringToFront(); medicamentDescription.Show(); } else { } } }
public EditMedicament(BaseMedicament medicament) { InitializeComponent(); editMedicament = medicament; InitializeTextBox(); }