Newbie asking for help Populating listview Control ??

N

Norman Fritag

Hi there
I like to populate a Listview with data. all the Program does is adding the
data to the first column.
There are five columns and I like to get the data into the appropriate
columns, not just into the first??
Where am I going wrong??

Here is the code snipple:
listviewdisplay is set to detail and It has 5 columns nothing else fancy
going on

' start ********************************
Dim itmx As ListViewItem
Dim item1 As New ListViewItem("item1", 1)
Dim item2 As New ListViewItem("item2", 2)
Dim item3 As New ListViewItem("item3", 3)
Dim item4 As New ListViewItem("item4", 4)
'
'
do
If FP.bList Then
'get the data, so add it to the listview
itmx = New lvExample.Items.Add(sTmp)
lvExample.Items.Add(LCase(sTmp)) ' works ok adds data to column 0
item1 = New ListViewItem("Item1", 1)
item1.SubItems.Add( sTmp & aName)
item3 = New ListViewItem("Itme3",3) ' desn't add anything to column 3 ??
item3.SubItems.Add(Somename)
item2 = New ListViewItem("Item2", 2) ' desn't add anything to column 2??
item2.SubItems.Add(somedata)
item4 = New ListViewItem("Item4", 4)
item4.SubItems.Add(somecasedata) ' desn't add anything to column 4
End If
Loop While aName = ""
' end codesnipple*************************************
 
W

William Ryan

What is the View property set to? If I understand the problem correctly,
setting it to Details should fix it for you.
 
C

Cor

Hi Norman,

I do it just like this

Dim itmx As New ListViewItem
itmx.Text = myspecial.Text
itmx.SubItems.Add("Something")
itmx.SubItems.Add("SomethingElse")
lvExample.Items.Add(itmx)

I hope this helps?

Cor
 
R

Russ Green

In the zip file is setup.exe and the source. You should run setup.exe as
this will place a sample access db on your system and also create the
necessary entries in your registry for the app to run.

Russ
 

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