Results 1 to 11 of 11

Thread: listview problems - need refresher

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    88

    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.

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Some sample code:

    VB Code:
    1. Me.ListView1.Arrange = lvwAutoLeft
    2.    
    3.     Dim itmX As ListItem
    4.    
    5.     Me.ListView1.ColumnHeaders.Add 1, "Name", "Inventory Reports", 4500
    6.    
    7.     Me.ListView1.ColumnHeaders.Add 2, "Description", "Description", 6000
    8.    
    9.     ' LOAD UP REPORT NAMES
    10.    
    11.     Set itmX = Me.ListView1.ListItems.Add(1, , "On-Job Inventory", 1, 1)
    12.    
    13.     itmX.SubItems(1) = "Total Consigned Inventory (On-Job Listing)"
    14.    
    15.     Set itmX = Me.ListView1.ListItems.Add(2, , "Idle Inventory...", 1, 1)
    16.    
    17.     itmX.SubItems(1) = "Idle Inventory Options"
    18.    
    19.     Set itmX = Me.ListView1.ListItems.Add(3, , "In-Use Inventory", 1, 1)
    20.    
    21.     itmX.SubItems(1) = "Total In-Use Inventory (On-Rent Listing)"
    22.    
    23.     Set itmX = Me.ListView1.ListItems.Add(4, , "In-Use by Category", 1, 1)
    24.    
    25.     itmX.SubItems(1) = "Total In-Use by Product Categories"
    26.    
    27.     Set itmX = Me.ListView1.ListItems.Add(5, , "In-Use Inventory Averages...", 1, 1)
    28.    
    29.     itmX.SubItems(1) = "Inventory Averages Options"
    30.    
    31.     Set itmX = Me.ListView1.ListItems.Add(6, , "Usages...", 1, 1)
    32.    
    33.     itmX.SubItems(1) = "Inventory Usages Options"
    34.    
    35.     Set itmX = Me.ListView1.ListItems.Add(7, , "Part Transfer Analysis", 1, 1)
    36.    
    37.     itmX.SubItems(1) = "Transfer Listing for a Part Number"
    38.    
    39.     Set itmX = Me.ListView1.ListItems.Add(8, , "Daily Usage Level", 1, 1)
    40.    
    41.     itmX.SubItems(1) = "Usage by Part Listing On-Job, In-Use, Idle, and Usages"
    42.    
    43.     Set itmX = Me.ListView1.ListItems.Add(9, , "Part Usage Analysis", 1, 1)
    44.    
    45.     itmX.SubItems(1) = "Usages for a selected Part"
    46.    
    47.     Set itmX = Me.ListView1.ListItems.Add(10, , "Inventory ERP Comparasion", 1, 1)
    48.    
    49.     itmX.SubItems(1) = "ERP vs Site Quantity Comparasions"
    50.    
    51.     Set itmX = Me.ListView1.ListItems.Add(11, , "Inventory Random Audit List", 1, 1)
    52.    
    53.     itmX.SubItems(1) = "Random Listing of Equipment for Audit Purposes"
    54.    
    55.     Set itmX = Me.ListView1.ListItems.Add(12, , "In-Use Inventory by ERP Number", 1, 1)
    56.    
    57.     itmX.SubItems(1) = " In-Use Inventory (On-Rent Listing) by Client"
    58.    
    59.     Set itmX = Me.ListView1.ListItems.Add(13, , "In-Use Utilization by ERP Number", 1, 1)
    60.    
    61.     itmX.SubItems(1) = "Usage Summary for Each Client"
    62.    
    63.     Set itmX = Me.ListView1.ListItems.Add(14, , "Part Tag / Scaffold Analysis", 1, 1)
    64.    
    65.     itmX.SubItems(1) = "Tag / Scaffold Listing for a Part Number"
    66.    
    67.     Set itmX = Me.ListView1.ListItems.Add(15, , "Daily Usage Level Analysis", 1, 1)
    68.    
    69.     itmX.SubItems(1) = "Analyze Least / Most Utilized Parts"
    70.    
    71.     Set itmX = Me.ListView1.ListItems.Add(16, , "MOST Utilized Parts Analysis", 1, 1)
    72.    
    73.     itmX.SubItems(1) = "Analyze MOST Utilized Parts"
    74.    
    75.     Set itmX = Me.ListView1.ListItems.Add(17, , "LEAST Utilized Parts Analysis", 1, 1)
    76.    
    77.     itmX.SubItems(1) = "Analyze LEAST Utilized Parts"
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    88
    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.


  4. #4
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Add an Imagelist for it to work...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    88
    no offense....but why do I need to add an imagelist?

    now i'm really getting cornfused.

  6. #6
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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....

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    88
    ok...did that and it still does not work. I only get the first "Hello". No other columns appear.

  8. #8
    Hyperactive Member Stiletto's Avatar
    Join Date
    Aug 2002
    Location
    Jerusalem, Israel
    Posts
    287
    Check your ListView Properties. Maybe you disabled something...

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    88
    just put it in on the form...no modifications made to the properties

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    88
    <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.

  11. #11
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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
  •  



Click Here to Expand Forum to Full Width