Exemplo n.º 1
0
        private void AlterarButton_Click(object sender, EventArgs e)
        {
            Carro carro = new Carro();

            try
            {
                carro.CarroId     = int.Parse(carroDataGridView.CurrentRow.Cells[0].Value.ToString());
                carro.MarcaId     = int.Parse(MarcaComboBox.SelectedValue.ToString());
                carro.Modelo      = modeloTextBox.Text;
                carro.Cor         = corTextBox.Text;
                carro.ValorDiaria = double.Parse(valorDiariaTextBox.Text);

                carro.Alterar(carro);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Erro!" + ex.Message);
            }
            finally
            {
                FormVeiculo_Load(sender, e);
                Clear_TextBox();
            }
        }