private void btnIncluirMedicamento_Click(object sender, EventArgs e) { DialogResult resultado = MessageBox.Show("Realizar inclusão?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (resultado == System.Windows.Forms.DialogResult.Yes) { try { ITENSUSUARIOCRONICOTableAdapter medicamentos = new ITENSUSUARIOCRONICOTableAdapter(); DateTime validade = DataReceita.Value.AddMonths((int)txMeses.Value); int incluir = medicamentos.Insert(int.Parse(txIdMedicamento.Text), int.Parse(txIdReceita.Text), (int)txQuantidade.Value, DataReceita.Value, validade); if (incluir == 1) MessageBox.Show("Incluido com sucesso"); else MessageBox.Show("Não foi possivel a inclusao"); txIdMedicamento.Clear(); txMedicamento.Clear(); this.txQuantidade.Value = new decimal(new int[] { 1, 0, 0, 0 }); this.ActiveControl = txMedicamento; CarregaMedicamentos(); } catch (Exception err) { MessageBox.Show(err.Message); } } }