private void btDevolve_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow.Index != -1) { alugarVeiculo form = new alugarVeiculo(Convert.ToInt32(dataGridView1.CurrentRow.Cells["ID"].Value, new CultureInfo("pt-BR")), "devolve"); try { if (form.ShowDialog() == DialogResult.OK) { PopularGrid(); form.Dispose(); } else { PopularGrid(); form.Dispose(); } } catch (ObjectDisposedException ex) { form.Dispose(); } } else { MessageBox.Show("Selecione um veiculo com status em uso antes de devolver"); } }
private void btAluga_Click(object sender, EventArgs e) { alugarVeiculo form = new alugarVeiculo(); if (form.ShowDialog() == DialogResult.OK) { PopularGrid(); form.Dispose(); } else { PopularGrid(); form.Dispose(); } }