Hello,
I face one problem in printing out the strings.
I show the example for easy reference.
For the output results, I attached the text file because this page cannot show my example outputs that I want to mean.
My Code
string str = "";
string[] fruit ={ "Orange", "Apple", "WaterMelon " };
for (int i = 0; i < fruit.Length; i++)
{
str += string.Format(" {0} {1,5} {2,5} {3,5}" + Environment.New Line,
fruit[i], "1", "2", "4");
}
Console.WriteLi ne(str);
For output, see my attachment.
So, please help me.
And , for another condition,
if the data to print are taken from the datarows in datatable, how can I write the code to get the output that I want.
Thanks,
I face one problem in printing out the strings.
I show the example for easy reference.
For the output results, I attached the text file because this page cannot show my example outputs that I want to mean.
My Code
string str = "";
string[] fruit ={ "Orange", "Apple", "WaterMelon " };
for (int i = 0; i < fruit.Length; i++)
{
str += string.Format(" {0} {1,5} {2,5} {3,5}" + Environment.New Line,
fruit[i], "1", "2", "4");
}
Console.WriteLi ne(str);
For output, see my attachment.
So, please help me.
And , for another condition,
if the data to print are taken from the datarows in datatable, how can I write the code to get the output that I want.
Thanks,
Comment