private void ComboBoxDistrito_SelectedValueChanged(object sender, EventArgs e) { Dictionary <int, string> ex = BLUbicacion.ObtenerListaSectores((int)ComboBoxDistrito.SelectedValue); ComboBoxSector.DataSource = new BindingSource(ex, null); ComboBoxSector.DisplayMember = "Value"; ComboBoxSector.ValueMember = "Key"; foreach (int key in ex.Keys) { ComboBoxSector.SelectedValue = key; break; } }
public void CargarDatos() { CampNombre.Text = ((PanelPerfil)this.Parent).Perfil.Nombre; Campapellido1erno.Text = ((PanelPerfil)this.Parent).Perfil.PrimerApellido; Campapellido2erno.Text = ((PanelPerfil)this.Parent).Perfil.SegundoApellido; CampDNI.Text = ((PanelPerfil)this.Parent).Perfil.Dni; CampHistoria.Text = ((PanelPerfil)this.Parent).Perfil.Historia; ComboSexo.SelectedValue = (int)((PanelPerfil)this.Parent).Perfil.Sexo; CampFecha.Value = ((PanelPerfil)this.Parent).Perfil.FechaNacimiento; CampDireccion.Text = ((PanelPerfil)this.Parent).Perfil.Direccion; ComboBoxDistrito.SelectedValue = ((PanelPerfil)this.Parent).Perfil.IdDistrito; ComboBoxSector.DataSource = new BindingSource(BLUbicacion.ObtenerListaSectores((int)ComboBoxDistrito.SelectedValue), null); ComboBoxSector.DisplayMember = "Value"; ComboBoxSector.ValueMember = "Key"; ComboBoxSector.SelectedValue = ((PanelPerfil)this.Parent).Perfil.IdSector; }
public PanelCrearPaciente() { InitializeComponent(); comboSexo.DataSource = new BindingSource(DiccionarioGeneral.GetInstance().TipoSexo, null); comboSexo.DisplayMember = "Value"; comboSexo.ValueMember = "Key"; Dictionary <int, string> ex = BLUbicacion.ObtenerListaDistritos(); ComboBoxDistrito.DataSource = new BindingSource(ex, null); ComboBoxDistrito.DisplayMember = "Value"; ComboBoxDistrito.ValueMember = "Key"; ComboBoxDistrito.SelectedValueChanged += ComboBoxDistrito_SelectedValueChanged; foreach (int key in ex.Keys) { ComboBoxDistrito.SelectedValue = key; break; } Dictionary <int, string> ex2 = BLUbicacion.ObtenerListaSectores((int)ComboBoxDistrito.SelectedValue); ComboBoxSector.DataSource = new BindingSource(ex2, null); ComboBoxSector.DisplayMember = "Value"; ComboBoxSector.ValueMember = "Key"; foreach (int key in ex2.Keys) { ComboBoxSector.SelectedValue = key; break; } campDNI.KeyPress += CampDNI_KeyPress; campNombre.KeyUp += CampNombre_KeyUp; campapellido1erno.KeyUp += CampPrimerApellido_KeyUp; campapellido2erno.KeyUp += CampSegundoApellido_KeyUp; campHistoria.KeyUp += CampHistoria_KeyUp; campDireccion.KeyUp += CampDireccion_KeyUp; }
private void ComboBoxDistrito_SelectionChangeCommitted(object sender, EventArgs e) { ComboBoxSector.DataSource = new BindingSource(BLUbicacion.ObtenerListaSectores((int)ComboBoxDistrito.SelectedValue), null); ComboBoxSector.DisplayMember = "Value"; ComboBoxSector.ValueMember = "Key"; }