hi guys,
i have a datagridview with a databinding. Now i have a Funktion to send mails.
when the mailform opens, im copying each cell.value into a list of strings.
to Format the strings right into my richtextbox (mailform), i insert "Tabs" \t.
Now the mail Looks good in my form, but if i send the mail, the Formation
of the text is truely ugly. Now im asking if there is another, better way
to Format my text?
Here is the code for inserting the cell values into my list:
for (int rowcounter = 0; rowcounter < nV_AUFPDataGridView.Rows.Count - 1; rowcounter++)
{
CellsInRow = nV_AUFPDataGridView.Rows[rowcounter].Cells.Count - 1;
for (int cellcounter = 0; cellcounter < nV_AUFPDataGridView.Rows[rowcounter].Cells.Count; cellcounter++)
{
string Text = "";
if (nV_AUFPDataGridView[cellcounter, rowcounter].Value == null)
{
Text = "0%\t";
_MailSetUp.AufpData.Add(Text);
continue;
}
if (cellcounter != 2)
{
Text = nV_AUFPDataGridView[cellcounter, rowcounter]
.Value.ToString() + "\t";
}
else
{
Text = nV_AUFPDataGridView[cellcounter,rowcounter]
.FormattedValue.ToString();
}
if (cellcounter == 0)
{
continue;
}
if (cellcounter == 2 || cellcounter == 5 || cellcounter == 7)
{
if (cellcounter == 5 || cellcounter == 7)
{
Text = Text + "€";
}
Text = Text + "\t";
}
if (cellcounter == CellsInRow)
{
Text = Text + "\r\n";
}
_MailSetUp.AufpData.Add(Text);
}
}
Thank you
Greets Niko