I am trying to align the text in the attachment
Thats my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Program_No2_Project
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void detailsButton_Click(object sender, EventArgs e)
{
Friend[] friends = new Friend[6];
string[] lines = File.ReadLines("namenANDumber.txt").ToArray<string>();
char[] ch = { ' ' };
for (int i = 0; i < friends.Length; i++)
{
friends[i] = new Friend();
string[] splits = lines[i].Split(ch);
friends[i].Name = splits[0] + splits[1];
friends[i].Phone = splits[2];
}
List<Friend> li = friends.OrderBy(c => c.Name).ToList<Friend>();
foreach (Friend f in li)
{
richTextBox1.Text += f.Name.ToString() + " " + f.Phone.ToString() + "\n\n";
}
}
}
public class Friend
{
private string name;
private string phone;
public string Name
{
get
{ return name; }
set
{ name = value; }
}
public string Phone
{
get
{ return phone; }
set
{ phone = value; }
}
}
}