private void CargaListaEnGrillaDeDatos() { try { this.listadoDataGridView.DataSource = misDatos.ObtenerListadoDeHotel(); if (this.listadoDataGridView.Rows.Count > 0) { this.listadoDataGridView.Rows[0].Selected = true; this.listadoDataGridView.CurrentCell = this.listadoDataGridView.Rows[0].Cells[0]; this.listadoDataGridView.Focus(); } this.editarLinkLabel.Enabled = (this.listadoDataGridView.Rows.Count.Equals(0) ? false : true); this.inhabilitarLinkLabel.Enabled = (this.listadoDataGridView.Rows.Count.Equals(0) ? false : true); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void TourForm_Load(object sender, EventArgs e) { DatosHotel misDatosHotel = DatosHotel.AbrirDatosHotel(); this.hotelComboBox.DataSource = misDatosHotel.ObtenerListadoDeHotel(); this.hotelComboBox.DisplayMember = "Nombre"; this.hotelComboBox.ValueMember = "Id"; DatosTransporte datosTransporte = DatosTransporte.AbrirDatosTransporte(); this.transporteComboBox.DataSource = datosTransporte.ObtenerListadoDeTransporte(); this.transporteComboBox.DisplayMember = "Transporte"; this.transporteComboBox.ValueMember = "ID"; this.misDatos = DatosTour.AbrirDatosTour(); this.editarLinkLabel.Enabled = false; this.inhabilitarLinkLabel.Enabled = false; this.habilitarCheckBox.Visible = false; this.CargaListaEnGrillaDeDatos(); this.estadoGrabacion = TipoGrabacion.None; this.ActivarListado(); }