Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Enabling multi line listing using listbox?

$
0
0
Hi guys,
I have a series of long text that I need to list in a listbox in VB6. However, I want it to be listed in multi line as the width of my listbox in my interface is quite narrow. It can only cater for around 45 characters per line.
This Listbox is supposed to list out the title of different documents and as such it needs to be flexible enough to cater for both text that are longer than 45 characters and shorter than 45 characters.

For instance, the two titles from two different files are as follows:

1. This is an agreement between Company A, Company B, Company C and Company D

2. Agreement 2008

Both needs to fit into the same list box on separate instances.

I cam up with something like this:

If Len(Title) > 45 Then
For x = 45 To 40 Step -1
If Mid$(Title, x, 1) = " " Then
Dialog.List5.AddItem Left(Title, x)
Dialog.List5.AddItem Right(Title, Len(Title) - x)
End If
Next
Else
Dialog.List5.AddItem arrSplitItem(4)
End If

But, it appeared it did not give me the expected results...

Can anybody tell me what's wrong with my logic? If any of you have any better ideas, do tell me. Thanks!

regards,
Robert

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>