alignment of strings representing integers

A

andrews

I try to add strings with fixed length who are representing integers
So I have to put spaces (I guesse) before short strings(from short
integers).

F.e.
12345
1
567
5432
54328

I am convinced that I can find a methode but I guesse that there must be
a simple method given by VB.NET but that I don't know.
Thanks for any response
 
A

andrews

I was thinking to be clear but here is the information

dim Number as integer
dim str1 as string = "Value is "
dim st as string
Number = 342
st = str1 & Number.tostring
 
G

Gillard

if you want your numbers to be represented like columns just use a textbox
like this

Dim r As New Random
With TextBox1
.RightToLeft = Windows.Forms.RightToLeft.Yes
.Multiline = True
.Dock = DockStyle.Fill
End With
For x = 0 To 100
TextBox1.AppendText(r.Next(0, 123456) & vbCrLf)
Next
 
A

andrews

Padleft is for me THE SOLUTION that is the most simplest
Thanks very much to everyone
 
P

Phill W.

andrews said:
I try to add strings with fixed length who are representing integers
I am convinced that I can find a methode but I guesse that there must be
a simple method given by VB.NET but that I don't know.

How about this:

Dim i as Integer = 77

? String.Format("({0,5})", i)
( 77)

HTH,
Phill W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top