is it possible to apply this kind of alignment in vb6 listbox?

Ex.

aaa     bbfawdawd
bbbb    adwadwa
cc      dawdawda

if it is possible. Please specify the solution. thank you

There are components that do this (try a search engine), or you could try and write it yourself, but the better solution would be to use a ListView instead.

I started to build the application using listbox, and it is almost finish. Is it possible to align that using a space() function and use the difference of array1(0) length to array1(1) length?

Ex.
len(array1(0)) = 10
len(array1(1)) = 5

10 - 5

lbx.additem wdawdawd & space(5) & dawdawdaw
lbx.additem dwadaw & space(5) & dwadwad

Yes, that is possible, but only if you use a fixed width font.

Just create a formatted string for each line you add.

commented: That's it. "Fixed width font" +10

I am confuse on constructing. Once ive try that, the output doesnt goes to what i wanted to. How do i implement that in vb6

...

the output was still the same as the previews

You first need to determine the longest item from the first column. Use that value for each item you add.

But i don't know how to start. Please help. thank you

Its properly much easier to work from the lefthand side of the list. You just roughly know the max length of the first string, give some space and add the second. so if x is the length of the max length string ,say 12, you do space(-x+15) & next string. This will place the second string always at pos 15,regardless of the length of the first string.
`Private Sub Form_Load()
Dim str1 As String
Dim str2 As String
Dim x As Integer
Dim x1 As Integer

str1 = "abc"
str2 = "abcdef"
x = Len(str1)
x1 = Len(str2)
List1.AddItem (str1) & Space(-x + 15) & (str1)
List1.AddItem (str2) & Space(-x1 + 15) & (str2)
End Sub Linup.jpg `

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.