private void DepartamentosToolStripMenuItem_Click(object sender, EventArgs e) { P_Posicion.Hide(); G_Dept.Show(); G_Posiciones.Hide(); P_Adm_Departamento.Show(); DgvDept.Visible = true; DgvDept.Enabled = false; try { DataSet ds = ProDepartamento.VistaDepartamento(); dt = ds.Tables[0]; DgvDept.DataSource = dt; C_Departamento.DisplayMember = "Departamento"; C_Departamento.ValueMember = "Id"; C_Departamento.DataSource = dt; } catch (Exception error) { MessageBox.Show(error.Message + error.StackTrace); } }
private void FDepartamento_Load(object sender, EventArgs e) { try { DataSet ds = ProDepartamento.VistaDepartamento(); dt = ds.Tables[0]; DgvDept.DataSource = dt; comboBox2.DisplayMember = "Departamento"; comboBox2.ValueMember = "Id"; comboBox2.DataSource = dt; } catch (Exception error) { MessageBox.Show(error.Message + error.StackTrace); } P_Posicion.Hide(); P_Menu.Show(); }