0

wassup guys im new to C# coding and i did a search but couldn't find exactly what im looking for. So i have a couple of text-boxes which holds string elements and integers

what i want to do is when these boxes are filled in i want to send a summary of the email to client/customer but the format is whats getting me.

(first, one) are strings equaling different text-boxes

my code is:

emailCompseTask.Body = first + one + Enviroment.NewLine +
                       second + two + Enviroment.NewLine

and so on problem is which i send thru email it shows something like this:

computer service25.00

instead of:

computer service      25.00

is there a way to add spacing to make this more presentable? or even a better way perhaps thanks in advance guys

3 Answers3

2

try this :

emailCompseTask.Body = first + one + "   "+ second + two ;

body takes as HTML input, check here for more spacing option.

Community
  • 1
  • 1
Mohammad Arshad Alam
  • 9,694
  • 6
  • 38
  • 61
0

I'm a bit confused, but you just want to add some spacing in the output? Just throw some spaces in there like you would another variable.

    first + " " + one + Environment.NewLine
    + second + " " + two + Environment.NewLine;
Jonesopolis
  • 25,034
  • 12
  • 68
  • 112
0

You can use a table

        string tableRow = @"<tr>
                       <td>{0}</td>
                       <td>{1}</td>
                    </tr>";

        string htmlTable = @"<table>
                             {0}
                            </table>";

        string rows = "";

        // Can do this in a loop 
        rows += string.Format(tableRow, first, one);
        rows += string.Format(tableRow, first, one);

        emailComseTask.Body = string.Format(htmlTable, rows);
lahsrah
  • 9,013
  • 5
  • 37
  • 67