Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6:ListView with one item per line ? 2

Status
Not open for further replies.

Lemox

Programmer
Dec 13, 2003
67
GB
Hi there,

I'm trying to display a listview with only one item per line (only one column).

i.e.
----

-item1
-item2
-...
-itemX
-itemY
-itemZ

View property is set to 'List' but what happens is that when there are many items, list continues in the next column (don't know if it is a real column): no vertical scrollbar, only horizontal.

i.e.
---
-item1 -itemY
-item2 -itemZ
-....
-itemX

Any idea ?

Thanks in advance.
Lemox
 
Change the lvwList to lvwReport style

Zameer Abdulla
[sub]Jack of Visual Basic Programming, Master in Dining & Sleeping[/sub]
Visit Me
 
Thx for replying.

I already tried to change to lvwReport : now my list doesn't display any item.
(I checked the .ListItems.Count property : 200 items)

Is there any other property to set when using it as 'Report' ?
 
Can you post your code?

Zameer Abdulla
[sub]Jack of Visual Basic Programming, Master in Dining & Sleeping[/sub]
Visit Me
 
In addition to that, you also need to insert atleast one columnheader to the listview in order to show the list items in report view.

See the following code.
___
[tt]
Option Explicit
Private Sub Form_Load()
Dim N As Long
With ListView1
.View = lvwReport
'.HideColumnHeaders = True
.ColumnHeaders.Add , , "Fonts", 4000
For N = 0 To Screen.FontCount - 1
.ListItems.Add , , Screen.Fonts(N)
Next
End With
End Sub
Private Sub Form_Resize()
ListView1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub[/tt]
 
Code:
Public Sub Init(ByVal Result As OO4ORecordset)
   Result.MoveFirst
   While not Result.EOF 
    Me.lstResult.ListItems.Add , , Result.Display
    Result.MoveNext
   Wend
End Sub

(Result.Display returns a string)
 
Yes Hypetia,
It was the reason I asked for the code

Zameer Abdulla
[sub]Jack of Visual Basic Programming, Master in Dining & Sleeping[/sub]
Visit Me
 
Perfect !

Stars for both of you..

Thx a lot !!
Lemox
 
Public Sub Init(ByVal Result As OO4ORecordset)
Me.lstResult.ColumnHeaders.Add , , "Result", 5000 'you can set the width here
Result.MoveFirst
While Not Result.EOF
Me.lstResult.ListItems.Add , , Result.Display
Result.MoveNext
Wend
End Sub



Zameer Abdulla
[sub]Jack of Visual Basic Programming, Master in Dining & Sleeping[/sub]
Visit Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top