private void preencheEstabelecimento() { if (!cbEstabelecimento.Enabled) cbEstabelecimento.Enabled = true; cbEstabelecimento.Items.Clear(); Dados dados = new Dados(); DataTable dtEstabelecimentos = new DataTable(); dtEstabelecimentos = dados.ObterTodosEstabelecimentos(obterCodigoBarras()); int id = 0; string nome = null; foreach (DataRow dr in dtEstabelecimentos.Rows) { id = Convert.ToInt32(dr["id_estabelecimento"]); nome = dr["nome"].ToString(); cbEstabelecimento.Items.Add(new Item(nome, id)); } if (cbEstabelecimento.Items.Count != 0) { cbEstabelecimento.SelectedIndex = 0; } }