Probably not, from your description.
A TextBox only holds Text - strings, and sorting is not one of it's features.
However, assuming your TextBox is multiline, it would be possible to put them into the TextBox in sorted order:
struct MyStruct : IComparable
{
public string UserName;
public int YearOfBirth;
public MyStruct(string s, int i) { UserName = s; YearOfBirth = i; }
public int CompareTo(object obj)
{
return YearOfBirth - ((MyStruct)obj).YearOfBirth;
}
}
...
MyStruct[] arr = new MyStruct[]
{
new MyStruct("Joe", 1959),
new MyStruct("Mike", 1972),
new MyStruct("Aaron", 1999),
new MyStruct("Jane", 1941)
};
Array.Sort(arr);
List<string> lines = new List<string>();
foreach (MyStruct ms in arr)
{
lines.Add(ms.UserName);
}
myTextBox.Lines = lines.ToArray();