Question

Whenever i use String.Format function to display dynamic content (in a listbox), the data that is being displayed goes out of range. Is there some way to keep data to stay in context or, by using another function or way to arrange data in a listbox?

http://i44.tinypic.com/iogpxs.jpg

Was it helpful?

Solution

Looking at your image, I understand what do you mean.

If you want your text correctly aligned in columns you need a control that offer the Columns functionality.
Like a ListView control or a DataGridView.

There is another alternative, but it is ugly to see. The disaligment happens because the ListBox use a proportional font and in a proportional font the width of each character is different (a space is shorter thant a w). You could try changing the Listbox font to a Fixed Size Font (Lucida Console, FixedSys) but as I have said the result is not pretty to see.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top