1
I have a string that is concatenated inside a loop, wanted that for each loop a new line was created with the concatenated values.
Follow the code I’m using:
mensagem ="";
for (int i = 0; i < titulosReceber.Rows.Count; i++)
mensagem += "Titulos: " + (titulosReceber[i].TitId).ToString() +
"FormaPagto: " + (titulosReceber[i].NomeMeioPagamento).ToString() +
"Valor: " + (titulosReceber[i].Valor).ToString() + " Dt. Venc: " +
(titulosReceber[i].dVenc)+"\n" ;
SalvarHistorico("Ação Faturar da Saida, gerado(s) o(s)"+ mensagem,
Historico.enumHistoricoTipo.SAI_Faturar, this.Saida[0].Id, IdOperador );
To string is concatenated, but does not break the line.
Where is this being used? The line break is present yes, it cannot be. But depending on where it is used, it will not appear because
\n
does not work in all contexts, such as HTML, for example. Line breaking in HTML is<br />
.– Maniero
You want the
SalvarHistorico
be called to each iteration?– user6406
Andre, if power just breaks the string it helps me enough.
– krispim
What @bigown said is correct,
\n
does not work on web pages, you should give a replace\n
for<br />
, must have some methods/mechanism to execute this replace– user6406
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero