Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why is not the columns aligned

7 views
Skip to first unread message

Tony

unread,
May 7, 2013, 2:00:48 PM5/7/13
to
Here I add three concatenated strings to a combobox.
As you can see a use PadRight so the columns should be aligned verically.
But this doesn't work the columns is not aligned in vertical.
I can't understand why is not work to use PadRight

datum = "2013-05-06";
prannr = "619".PadRight(8);
skiftbeskr = "DayTime".PadRight(15);
loopnrDag = "2".PadRight(5);
rad = datum + " | " + prannr + " | " + skiftbeskr + " | " +
loopnrDag;
this.listAllSkift.Items.Add(rad);

datum = "2013-05-06";
prannr = "619".PadRight(8);
skiftbeskr = "DayTime".PadRight(15);
loopnrDag = "3".PadRight(5);
rad = datum + " | " + prannr + " | " + skiftbeskr + " | " +
loopnrDag;
this.listAllSkift.Items.Add(rad);

datum = "2013-05-06";
prannr = "0".PadRight(8);
skiftbeskr = "DayTime".PadRight(15);
loopnrDag = "3".PadRight(5);
rad = datum + " | " + prannr + " | " + skiftbeskr + " | " +
loopnrDag;
this.listAllSkift.Items.Add(rad);

//Tony

Anders Eriksson

unread,
May 7, 2013, 2:27:15 PM5/7/13
to
You don't specify if you're using Winform, WPF, ...

But, either you need to use a fixed-width font (e.g. Courier New) or
use a multi-column combobox.

Here is one winform sample of a multi-column combobox
http://www.codeproject.com/Articles/3206/Multi-Column-ComboBox

// Anders


--
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.
0 new messages