I’ have a Static Text that says this:
SERIE FOLIO SUBTOTAL I. V. A. TOTAL ANTICIPO FONDO DE GARANTA
And after this I made a recordset and get the data of it adding rows for each “column”.
I said “Column” because aren’t real columns. These data must be in one column of a Listbox.
So I planned to add “X” number of spaces between Word 1 and Word 2 and so on.
Example.
The first Row said: B A152669
The second Row said: NORMAL B589C
The space necessary to get aligned Folio column on both rows are:
First Column: 24 spaces
Second Column: 12 Spaces
I count the length of both Strings using LEN, and counting spaces before to start “FOLIO” text. is “26”.
So I do this:
SerieLength = 26- (rsDetalleObra.IdxField(1).StringValue.DefineEncoding(Encodings.UTF8).UpperCase().ReplaceAll("&", "&&").Len *2)
As you can see I multiply by TWO the length of the String, because I noticed that UPPERCASE characters occupies two places.
Once got the Value of SerieLength I use a Method to add as many spaces as I need to add:
Function Space (n as Integer) As String
static sp as string = " "
while len(sp)< n
sp = sp + sp
wend
return left(sp, n)
End Function
And Finally I do this:
Text1+Space(SerieLength)+Text2
But not works as I wanted, I ran a Messagebox to SerieLength and I discovered that when then “NORMAL” text occurs I got 14 spaces, instead of 12.
Am I omitting something?
Regards