|
-
Jun 3rd, 2003, 02:10 PM
#1
Thread Starter
Lively Member
listview problems - need refresher
I am having a whale of a time trying to populate a listview control. I can't seem to remember how to do it and I have went over countless examples here and nothing seems to be working. I am using vb6.0. In my references, I have ADO Ext 2.7 and ActiveX Data Objects 2.5.
I know it has to be something simple that I am missing.
Can some provide me a simple refresher on adding data to a 4 column listview?
Thanks greatly.
-
Jun 3rd, 2003, 02:13 PM
#2
PowerPoster
Well
Some sample code:
VB Code:
Me.ListView1.Arrange = lvwAutoLeft
Dim itmX As ListItem
Me.ListView1.ColumnHeaders.Add 1, "Name", "Inventory Reports", 4500
Me.ListView1.ColumnHeaders.Add 2, "Description", "Description", 6000
' LOAD UP REPORT NAMES
Set itmX = Me.ListView1.ListItems.Add(1, , "On-Job Inventory", 1, 1)
itmX.SubItems(1) = "Total Consigned Inventory (On-Job Listing)"
Set itmX = Me.ListView1.ListItems.Add(2, , "Idle Inventory...", 1, 1)
itmX.SubItems(1) = "Idle Inventory Options"
Set itmX = Me.ListView1.ListItems.Add(3, , "In-Use Inventory", 1, 1)
itmX.SubItems(1) = "Total In-Use Inventory (On-Rent Listing)"
Set itmX = Me.ListView1.ListItems.Add(4, , "In-Use by Category", 1, 1)
itmX.SubItems(1) = "Total In-Use by Product Categories"
Set itmX = Me.ListView1.ListItems.Add(5, , "In-Use Inventory Averages...", 1, 1)
itmX.SubItems(1) = "Inventory Averages Options"
Set itmX = Me.ListView1.ListItems.Add(6, , "Usages...", 1, 1)
itmX.SubItems(1) = "Inventory Usages Options"
Set itmX = Me.ListView1.ListItems.Add(7, , "Part Transfer Analysis", 1, 1)
itmX.SubItems(1) = "Transfer Listing for a Part Number"
Set itmX = Me.ListView1.ListItems.Add(8, , "Daily Usage Level", 1, 1)
itmX.SubItems(1) = "Usage by Part Listing On-Job, In-Use, Idle, and Usages"
Set itmX = Me.ListView1.ListItems.Add(9, , "Part Usage Analysis", 1, 1)
itmX.SubItems(1) = "Usages for a selected Part"
Set itmX = Me.ListView1.ListItems.Add(10, , "Inventory ERP Comparasion", 1, 1)
itmX.SubItems(1) = "ERP vs Site Quantity Comparasions"
Set itmX = Me.ListView1.ListItems.Add(11, , "Inventory Random Audit List", 1, 1)
itmX.SubItems(1) = "Random Listing of Equipment for Audit Purposes"
Set itmX = Me.ListView1.ListItems.Add(12, , "In-Use Inventory by ERP Number", 1, 1)
itmX.SubItems(1) = " In-Use Inventory (On-Rent Listing) by Client"
Set itmX = Me.ListView1.ListItems.Add(13, , "In-Use Utilization by ERP Number", 1, 1)
itmX.SubItems(1) = "Usage Summary for Each Client"
Set itmX = Me.ListView1.ListItems.Add(14, , "Part Tag / Scaffold Analysis", 1, 1)
itmX.SubItems(1) = "Tag / Scaffold Listing for a Part Number"
Set itmX = Me.ListView1.ListItems.Add(15, , "Daily Usage Level Analysis", 1, 1)
itmX.SubItems(1) = "Analyze Least / Most Utilized Parts"
Set itmX = Me.ListView1.ListItems.Add(16, , "MOST Utilized Parts Analysis", 1, 1)
itmX.SubItems(1) = "Analyze MOST Utilized Parts"
Set itmX = Me.ListView1.ListItems.Add(17, , "LEAST Utilized Parts Analysis", 1, 1)
itmX.SubItems(1) = "Analyze LEAST Utilized Parts"
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jun 3rd, 2003, 02:37 PM
#3
Thread Starter
Lively Member
using your code I have the following in the Form_Load event:
listview1.arrange=lvwautoleft
dim itmx as listitem
listview1.columnheaders.add 1,"name","Name",1000
listview1.columnheaders.add 2,"desc","Description",1000
set itmx=listview1.listitems.add(1,,"hello",1,1)
itmx.subitems(1)="hello1"
itmx.subitems(2)="hello2"
I run the program and get the following error:
Run-Time error '35613'
ImageList must be initialized before it can be used
I do not have an ImageList in my program.
-
Jun 3rd, 2003, 02:55 PM
#4
PowerPoster
Well
Add an Imagelist for it to work...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jun 3rd, 2003, 02:59 PM
#5
Thread Starter
Lively Member
no offense....but why do I need to add an imagelist?
now i'm really getting cornfused.
-
Jun 3rd, 2003, 03:05 PM
#6
PowerPoster
Well
The imagelist just adds images to the 1st item. Remove the index numbers if you do not wish to include images...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jun 3rd, 2003, 03:07 PM
#7
Thread Starter
Lively Member
ok...did that and it still does not work. I only get the first "Hello". No other columns appear.
-
Jun 3rd, 2003, 03:08 PM
#8
Hyperactive Member
Check your ListView Properties. Maybe you disabled something...
-
Jun 3rd, 2003, 03:10 PM
#9
Thread Starter
Lively Member
just put it in on the form...no modifications made to the properties
-
Jun 3rd, 2003, 03:17 PM
#10
Thread Starter
Lively Member
<screams out loud and begins to pull hair out>
Found the problem: Change view property to report.
GRRRRRRRR!!!!!
knew it had to be something simple! dad gummit!
Now hopefully I can remember how to sort it. Maybe leave that until tomorrow......need some recovery time.
thanks guys for all your help.
-
Jun 3rd, 2003, 03:27 PM
#11
PowerPoster
Well
I should have pointed that out, but glad to hear you got it working...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|