private void comboBoxUF_SelectedIndexChanged(object sender, EventArgs e) { CbList dbCtrl = new CbList(); this.comboBoxCity.DataSource = dbCtrl.listCity(this.comboBoxUF.Text); this.comboBoxCity.DisplayMember = "Nome"; }
private void ComboBoxes(panel pnl) { this.stslbl1.Text = "Carregando..."; CbList dbCtrl = new CbList(); if (pnl == panel.Insert) { this.comboBoxUF.DataSource = dbCtrl.listUf(); this.comboBoxUF.DisplayMember = "Uf"; this.comboBoxUF.Text = "SP"; this.comboBoxCity.DataSource = dbCtrl.listCity(this.comboBoxUF.Text); this.comboBoxCity.DisplayMember = "Nome"; this.comboBoxCity.Text = "São José dos Campos"; } else if (pnl == panel.Update) { this.comboBoxEUF.DataSource = dbCtrl.listUf(); this.comboBoxEUF.DisplayMember = "Uf"; this.comboBoxECity.DataSource = dbCtrl.listCity(this.comboBoxUF.Text); this.comboBoxECity.DisplayMember = "Nome"; } this.stslbl1.Text = "Carregado"; }