Results 1 to 5 of 5

Thread: VB - Add a progress bar as a listview item

  1. #1

    Thread Starter
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857

    VB - Add a progress bar as a listview item

    I have seen this asked before, but never answered. This will add a progress bar as a listview item. (See image in attachment)

    VB Code:
    1. Option Explicit
    2.  
    3. Dim itmX As ListItem
    4. Dim i As Integer
    5. Dim j As Integer
    6.  
    7. Private Declare Function SetParent _
    8.        Lib "user32" _
    9.        (ByVal hWndChild As Long, _
    10.        ByVal hWndNewParent As Long) As Long
    11.  
    12. Private Sub Form_Load()
    13.     pbrStatus.Max = 4000
    14.     pbrStatus.Value = 0
    15.     pbrStatus.Visible = False
    16.     SetParent pbrStatus.hWnd, lvwExample.hWnd
    17. End Sub
    18. Private Sub cmdGo_Click()
    19.     pbrStatus.Visible = True
    20.     lvwExample.ListItems.Clear
    21.     For j = 1 To 10
    22.         pbrStatus.Value = 0
    23.         Set itmX = lvwExample.ListItems.Add
    24.         itmX.Text = "Downloading File " & Format(j, "00000")
    25.         lvwExample.ListItems.Item(lvwExample.ListItems.Count).Selected = True
    26.         lvwExample.SelectedItem.EnsureVisible
    27.         itmX.SubItems(1) = "Completed"
    28.         With pbrStatus
    29.             .Move itmX.Left + lvwExample.ColumnHeaders(1).Width, itmX.Top, itmX.Width, itmX.Height
    30.             .Width = lvwExample.ColumnHeaders(2).Width
    31.             .Height = itmX.Height
    32.         End With
    33.         For i = 1 To 4000
    34.             pbrStatus.Value = i
    35.             DoEvents
    36.         Next i
    37.     Next j
    38.     pbrStatus.Visible = False
    39.     pbrStatus.Value = 0
    40. End Sub
    41. Private Sub cmdExit_Click()
    42.     Unload Me
    43. End Sub
    Attached Files Attached Files
    Last edited by Armbruster; Mar 21st, 2003 at 03:05 PM.
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

  2. #2

    Thread Starter
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857
    Here is an image:

    Attached Images Attached Images  
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

  3. #3
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: VB - Add a progress bar as a listview item

    does it realy download thing ?

  4. #4

    Thread Starter
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857

    Re: VB - Add a progress bar as a listview item

    Quote Originally Posted by tony007
    does it realy download thing ?
    um . . . . did you look at the code? It does not download anything, it is simply an example of how to display a progress bar as a listview item. The "now downloading" text was just an example of an instance where this type of code could be used.
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

  5. #5
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: VB - Add a progress bar as a listview item

    Quote Originally Posted by Armbruster
    um . . . . did you look at the code? It does not download anything, it is simply an example of how to display a progress bar as a listview item. The "now downloading" text was just an example of an instance where this type of code could be used.
    well it was nice if it had the feture to download . I wonder how that can be don . For example you give it a series of song urls and it goes download the songs from and track prograss of each download. I be happy if u show me how that can be done.Thanks

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