private void cmbChofer_SelectedIndexChanged(object sender, EventArgs e) { //cuando selecciona un chofer tengo que cargar el automovil de ese chofer try { //Obtengo el automovil y lo muestro en el txt. Automovil auto = new Automovil(); DataSet ds = auto.ObtenerAutomovilPorChofer(Convert.ToInt32(cmbChofer.SelectedValue)); auto.DataRowToObject(ds.Tables[0].Rows[0]); if (ds.Tables[0].Rows.Count != 0) { txtAutomovil.Text = auto.Patente; IDAutomovil = auto.IDAutomovil; } cargarTurnos(); } catch (ErrorConsultaException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }