Search code examples
c#.netlistbox

How to display blank spaces correctly while writing to a listbox in C#


I am reading a file and printing to a list box in .While writing to the list box, the items are not properly aligned and spaces are also not formatted correctly. When I try to print it using **console. WriteLine ** method, the output is displaying exactly the same format as that of the input file.

Is there any standard way to handle the spaces and alignment while writing to a list box in c#.net?


Solution

  • The monospace font resolved the issue. I changed the font from sans-serif to courier new and everything looks perfect.

    Thnaks to Ralf.