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:
Option Explicit Dim itmX As ListItem Dim i As Integer Dim j As Integer Private Declare Function SetParent _ Lib "user32" _ (ByVal hWndChild As Long, _ ByVal hWndNewParent As Long) As Long Private Sub Form_Load() pbrStatus.Max = 4000 pbrStatus.Value = 0 pbrStatus.Visible = False SetParent pbrStatus.hWnd, lvwExample.hWnd End Sub Private Sub cmdGo_Click() pbrStatus.Visible = True lvwExample.ListItems.Clear For j = 1 To 10 pbrStatus.Value = 0 Set itmX = lvwExample.ListItems.Add itmX.Text = "Downloading File " & Format(j, "00000") lvwExample.ListItems.Item(lvwExample.ListItems.Count).Selected = True lvwExample.SelectedItem.EnsureVisible itmX.SubItems(1) = "Completed" With pbrStatus .Move itmX.Left + lvwExample.ColumnHeaders(1).Width, itmX.Top, itmX.Width, itmX.Height .Width = lvwExample.ColumnHeaders(2).Width .Height = itmX.Height End With For i = 1 To 4000 pbrStatus.Value = i DoEvents Next i Next j pbrStatus.Visible = False pbrStatus.Value = 0 End Sub Private Sub cmdExit_Click() Unload Me End Sub




Reply With Quote