private void PreencherGrid(ArrayList listaLinhas) { TextoBLL textoBLL = new TextoBLL(); foreach (var linha in listaLinhas) { if (linha == null) { continue; } string[] coluna = linha.ToString().Split(','); //Se já passou por algum linha com problema, não validar novamente if (!linhaErro) { linhaErro = textoBLL.ValidarLinhas(coluna); //Houve erro? Então avisa na tela if (linhaErro) { lblErro.Visible = true; } } //Populando grid com os dados importados dgvGrid.Rows.Add(coluna[1], //local coluna[2].Replace('.', ','), //valor coluna[0], //data coluna[3]); //tipo gasto } //Altera automaticamente para a tabPage de Grid tbPrincipal.SelectedIndex = 1; }
private void btnImportar_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtArquivo.Text)) { MessageBox.Show("Não há dados para importação!"); return; } TextoBLL textoBLL = new TextoBLL(); ArrayList listaRetorno = textoBLL.processaTexto(txtArquivo.Text); PreencherGrid(listaRetorno); ControlarTelaImportar(); }