Listview Shows No Text

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,835
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Must have done something wrong as although no errors nothing shows in the Listview control except gridlines.
The Userform has a Frame and one listbox. Properties are:

(Name) ListView1
AllowColumnReorder False
Appearance 1 - cc3D
Arrange 0 - lvwNone
BackColor &H80000005&
BorderStyle 0 - ccNone
Checkboxes False
ControlTipText
Enabled True
FlatScrollBar False
Font Tahoma
ForeColor &H00000000&
FullRowSelect True
GridLines True
Height 90
HelpContextID 0
HideColumnHeaders True
HideSelection False
HotTracking False
HoverSelection False
LabelEdit 0 - lvwAutomatic
LabelWrap True
Left 3
MouseIcon (None)
MousePointer 0 - ccDefault
MultiSelect False
OLEDragMode 0 - ccOLEDragManual
OLEDropMode 0 - ccOLEDropNone
Picture (None)
PictureAlignment 0 - lvwTopLeft
Sorted False
SortKey 0
SortOrder 0 - lvwAscending
TabIndex 0
TabStop True
Tag
TextBackground 0 - lvwTransparent
Top 30
View 3 - lvwReport
Visible True
Width 255

VBA Code:
Private Sub UserForm_Activate()
    Dim li As ListItem
    Dim w As Integer
    With Me.Frame1.ListView1
        For w = 0 To 3 'Add some items
            Set li = .ListItems.Add(, , "TestRowItem")
        Next
    End With
End Sub
I have tried both Me.Frame1.ListView1, and Me.ListView1 in both Userform Activate and Initialize events.
I want one column only and no headers.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
A ListBox and a ListView are two different Objects (the latter is part of the dotNET-framework).
If you are using a ListBox, try this:
VBA Code:
Private Sub UserForm_Initialize()
    Dim w As Integer
    With Me.Frame1.ListBox1
        For w = 0 To 3 'Add some items
            .AddItem (w & "TestRowItem")
        Next
    End With
End Sub
 
Upvote 0
Ah, I see now I wrote "listbox" on line 2, I meant Listview"
I did sort the problem though, you need .ColumnHeaders.Add even if you don't want headers.
Thanks for replying though.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top