• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Padding in treeview

I'm populating a treeview from a datatable.  I can create all the nodes I want OK but I'm having trouble with the formatting.  Can anyone explain why the following does not give equal "columns" :

oNode.Nodes.Add(oRow(0).ToString.PadRight(20) & oRow(1).ToString.PadRight(50) & _
                            oRow(2).ToString.PadLeft(10) & oRow(3).ToString.PadLeft(10) & _
                            oRow(4).ToString.PadLeft(10))

Thanks
0
Petermcg001
Asked:
Petermcg001
1 Solution
 
TimCotteeHead of Software ServicesCommented:
Hello Petermcg001,

Probably because you are using proportional fonts. To have equal columns with this method you must use non-proportional fonts such as courier where each character takes up the same width regardless. Normal proportional fonts allow differing characters to take up different amounts of space in order to read more naturally but therefore do not align when padded like this.

Regards,

TimCottee
0
 
Petermcg001Author Commented:
Thanks Tim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now