[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • 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
 
TimCotteeCommented:
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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