I'm trying to write strings with spaces into a listbox, and keep them aligned.
Here is the code:
List<String> treeNames = new List<String>();
int counter = 1;
treeNames.Add("Input ");
treeNames.Add("Output ");
treeNames.Add("Sequence Type ");
foreach (String currentData in treeNames)
{
listBox1.Items.Add(currentData + " - " + counter.ToString());
counter+=1;
}
Here's what I hope to achieve:
Input - 1
Output - 2
Sequence Type - 3
Instead, I'm getting:
Input - 1
Output - 2
Sequence Type - 3
Any ideas how can I align them?