Home > Software engineering >  VS2010 VB, string cannot be aligned to solve
VS2010 VB, string cannot be aligned to solve

Time:10-11

For example, there are two note:

Dim str1 str2, STRW as string

Str1="03 01, 02,"
Str2="05"
STRW=""

If I want the following alignment effect:

02 03 01
05

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

STRW=str1 & amp; VbCrLf & amp; Str2. PadLeft (8)


Dim As Control pr=Me

Dim loca As Point

The loca. X=Me. Left + 100
Loca. Y=Me. Top + 100

Help. ShowPopup (pr, STRW, loca)

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The actual display effect:

02 03 01
05

The length of the two strings are eight, but the width of the two strings actual display is different,
Tests show that adding a single space and the actual width of the single digital characters, such as five Spaces with the width of the five characters of 12345 different!
Should be the problem of character code, but no associated Settings in VB environment by default,

In VS2008, such operation, are completely aligned!

Why, how to deal with and seek solutions,


==============================problem extension:


In the same way [str2 PadLeft (8)] string processing, the output in DataGridVeiw cell, are aligned properly!

Is to use the Help. ShowPopup (pr, STRW, loca) method can't align!
  • Related