private void ComboBoxCategoria() { SISCategoria_TO SISCategoriaTO = new SISCategoria_TO(); SISCategoriaTO.tag = "PopularComboBoxCategoria"; DataTable dt = new SISCategoria_BO().GetCategoria(SISCategoriaTO); foreach (DataRow row in dt.Rows) { if (row["CAT_NOME"].ToString() != null) { string input = row["CAT_NOME"].ToString(); var myInt = int.Parse(row["CAT_CODIGO"].ToString()); input.Replace(" ", ""); string pattern = @"(?i)[^0-9a-záéíóúàèìòùâêîôûãõç\s]"; string replacement = ""; Regex rgx = new Regex(pattern); string result = rgx.Replace(input, replacement); this.cmbProCategoria.Items.Insert(myInt, input); } } }
private void PopularGridCategoria() { SISCategoria_TO SISCategoriaTO = new SISCategoria_TO(); try { SISCategoriaTO.tag = "PopularComboBoxCategoria"; using (DataTable dt = new SISCategoria_BO().GetCategoria(SISCategoriaTO)) { gridViewCategoria.DataSource = dt; }; } catch (Exception ex) { Uteis.ExibirMensagem(ex.Message, titulo, TipoMensagem.Erro); } }