private void DestinosForm_Load(object sender, EventArgs e) { DatosTransporte datosTransporte = DatosTransporte.AbrirDatosTransporte(); this.transporteComboBox.DataSource = datosTransporte.ObtenerListadoDeTransporte(); this.transporteComboBox.DisplayMember = "Transporte"; this.transporteComboBox.ValueMember = "ID"; this.misDatos = DatosDestino.AbrirDatosDestino(); this.editarLinkLabel.Enabled = false; this.inhabilitarLinkLabel.Enabled = false; this.habilitarCheckBox.Visible = false; this.CargaListaEnGrillaDeDatos(); this.estadoGrabacion = TipoGrabacion.None; this.ActivarListado(); }
private void CargaListaEnGrillaDeDatos() { try { this.listadoDataGridView.DataSource = misDatos.ObtenerListadoDeTransporte(); this.OcultarColumnas(); 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); } }