Results 1 to 2 of 2

Thread: ListView and URL to SubItem ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    282

    ListView and URL to SubItem ?

    Hello,
    I use below code for my api and here is sample of text what I load and what I need next.
    My listview are CheckBoxes!

    This is List.txt
    ======================================================
    My File1:v.1.0:Great SW:http://www.something.com/get something1.zip
    My File2:v.1.0:Great SW:http://www.something.com/get something2.zip
    My File3:v.1.0:Great SW:http://www.something.com/get something3.zip
    My File4:v.1.0:Great SW:http://www.something.com/get something4.zip
    ======================================================

    I dont want to load URL link in listview
    When I select for example 2 checkboxes and press commadn2
    to be able download thouse 2 file, 1 afther another
    Any help are welcome


    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3. On Error GoTo listviewERROR
    4. ListView1.ListItems.Clear
    5. ListView1.ColumnHeaders.Clear
    6. Dim itmX As ListItem ' Create a variable to add ListItem objects.
    7.     Dim clmX As ColumnHeader ' Create an object variable for the ColumnHeader object.
    8.     Dim ff As Integer
    9.     Dim strParts() As String
    10.     Dim strLine As String
    11.    
    12.     ff = FreeFile
    13.    
    14.    ' Add ColumnHeaders.
    15.     Set clmX = ListView1.ColumnHeaders.Add(, , "File", ListView1.Width / 2.5)
    16.     Set clmX = ListView1.ColumnHeaders.Add(, , "Version", ListView1.Width / 2.5)
    17.     Set clmX = ListView1.ColumnHeaders.Add(, , "About", ListView1.Width / 0.5)
    18.     ListView1.BorderStyle = ccFixedSingle ' Set BorderStyle property.
    19.     ListView1.View = lvwReport ' Set View property to Report.
    20.    
    21.     Open "C:\List.txt" For Input As ff
    22.    
    23.     Do Until EOF(ff)
    24.         Line Input #ff, strLine
    25.         strParts = Split(strLine, ":")
    26.         ' Add a main item
    27.         Set itmX = ListView1.ListItems.Add(, , RTrim(strParts(0)))
    28.         ' Add a subitem for that item
    29.         itmX.SubItems(1) = strParts(1)
    30.         itmX.SubItems(2) = strParts(2)
    31.     Loop
    32.  
    33.     Close ff
    34.     Exit Sub
    35.    
    36. listviewERROR:
    37.     List1.Clear
    38.     List1.AddItem "Error number 14001!" ' File are modified
    39.    
    40.     Exit Sub
    41. End Sub

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: ListView and URL to SubItem ?

    To be able to download without rereading the textfile, then you need to store the URL somewhere. Try the Tag property if you don't want to show thr URl to the user.

    VB Code:
    1. Do Until EOF(ff)
    2.         Line Input #ff, strLine
    3.         strParts = Split(strLine, ":")
    4.         ' Add a main item
    5.         Set itmX = ListView1.ListItems.Add(, , RTrim(strParts(0)))
    6.         itmX.Tag = strParts(3)
    7.         ' Add a subitem for that item
    8.         itmX.SubItems(1) = strParts(1)
    9.         itmX.SubItems(2) = strParts(2)
    10.     Loop

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