title: progress bar while excel file saving help please
body: <p>I have a form and a button on that form.When the user clicks on the button an MS-Excel sheet is generated from access database and saved in a particular location.As this generation of excel tkes sometime to complete,what i want to do is i want to show a progressbar loading till the entire sheet is generated.
  Showing the progress bar will help the user to understand that the generating of excel is under process. </p>
  
  <p>how can i do this any help pleas ?</p>
  
  <p>this is my code :</p>
  
  <pre><code>Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
       Try
          Dim saveFileDialog1 As New SaveFileDialog
          saveFileDialog1.Filter = "Excel File|*.xlsx"
          saveFileDialog1.Title = "Save an Excel File"
          saveFileDialog1.ShowDialog()
          If saveFileDialog1.FileName &lt;&gt; "" Then
              saveExcelFile(saveFileDialog1.FileName)
          End If
          MessageBox.Show("Excel file Saved!")
      Catch ex As Exception
  
      End Try
  End Sub
  Public Sub saveExcelFile(ByVal FileName As String)
      Try
          Dim xls As Microsoft.Office.Interop.Excel.Application
          xls = New Microsoft.Office.Interop.Excel.Application
          Dim sheet As Excel.Worksheet
          Dim i As Integer
          xls.Workbooks.Add()
          sheet = xls.ActiveWorkbook.ActiveSheet
          Dim row As Integer = 1
          Dim col As Integer = 1
          For i = 0 To Me.ListView1.Columns.Count - 1
              sheet.Cells(1, i + 1) = Me.ListView1.Columns(i).Text
          Next
          For i = 0 To Me.ListView1.Items.Count - 1
              For j = 0 To Me.ListView1.Items(i).SubItems.Count - 1
                  sheet.Cells(i + 2, j + 1) = Me.ListView1.Items(i).SubItems(j).Text
              Next
          Next
  
          row += 1
          col = 1
  
          ' for the header 
          sheet.Rows(1).Font.Name = "DotumChe"
          sheet.Rows(1).Font.size = 15
          sheet.Rows(1).HorizontalAlignment = Excel.XlVAlign.xlVAlignCenter
          Dim mycol As System.Drawing.Color = System.Drawing.ColorTranslator.FromHtml("#20B2AA")
          sheet.Rows(1).Font.color = mycol
          ' for all the sheet without header
          sheet.Range("a2", "z1000").Font.Name = "Arial"
          sheet.Range("a2", "z1000").Font.Size = 13
          sheet.Range("a2", "z1000").HorizontalAlignment = Excel.XlVAlign.xlVAlignCenter
  
          sheet.Range("A1:X1").EntireColumn.AutoFit()
          sheet.Range("A1:X1").EntireRow.AutoFit()
  
          xls.ActiveWorkbook.SaveAs(FileName)
          xls.Workbooks.Close()
          xls.Quit()
      Catch ex As Exception
  
      End Try
  End Sub
  </code></pre>