Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. progress bar

progress bar

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hsprasain
    wrote on last edited by
    #1

    Hey all: I have written a code that will export my data from Datagrids to Excel. It is taking sometime to write the data in excel file. I thought it would be better if I could provide some visual feed back to user like in progress bar or any other when my application writes data in Excel. Can any body help me how to set the inteval and how can know that excel application is opened from the code? Others type of suggestions for achieving my tasks is highly appreciated.

    S 1 Reply Last reply
    0
    • H hsprasain

      Hey all: I have written a code that will export my data from Datagrids to Excel. It is taking sometime to write the data in excel file. I thought it would be better if I could provide some visual feed back to user like in progress bar or any other when my application writes data in Excel. Can any body help me how to set the inteval and how can know that excel application is opened from the code? Others type of suggestions for achieving my tasks is highly appreciated.

      S Offline
      S Offline
      smguc
      wrote on last edited by
      #2

      Hi, Don't know if this will help, But I have used this a few times in excel to show a progress in the status bar... Sub StatusProgress() ' ' Progress Application Statusbar ' Dim intIndex As Integer Dim sngPercent As Single Dim intMax As Integer intMax = 100 For intIndex = 1 To intMax sngPercent = intIndex / intMax ProgressStyle sngPercent DoEvents '------------------------ ' Your code would go here '------------------------ Sleep 100 Next Application.StatusBar = False End Sub Function ProgressStyle(Percent As Single) ' Progress Style ' Application Status bar ' Pulsing ' Dim strTemp As String Dim intIndex As Integer Dim intLen As Integer intLen = 21 intIndex = Int((Percent * 100) Mod intLen) strTemp = String(intLen, txtPg7a.Text) If intIndex > 0 Then Mid(strTemp, intIndex, 1) = txtPg7p.Text End If Application.StatusBar = "Processing " & strTemp End Function Cheers, Stefan.

      All answers have a question? All code has an end.

      S 1 Reply Last reply
      0
      • S smguc

        Hi, Don't know if this will help, But I have used this a few times in excel to show a progress in the status bar... Sub StatusProgress() ' ' Progress Application Statusbar ' Dim intIndex As Integer Dim sngPercent As Single Dim intMax As Integer intMax = 100 For intIndex = 1 To intMax sngPercent = intIndex / intMax ProgressStyle sngPercent DoEvents '------------------------ ' Your code would go here '------------------------ Sleep 100 Next Application.StatusBar = False End Sub Function ProgressStyle(Percent As Single) ' Progress Style ' Application Status bar ' Pulsing ' Dim strTemp As String Dim intIndex As Integer Dim intLen As Integer intLen = 21 intIndex = Int((Percent * 100) Mod intLen) strTemp = String(intLen, txtPg7a.Text) If intIndex > 0 Then Mid(strTemp, intIndex, 1) = txtPg7p.Text End If Application.StatusBar = "Processing " & strTemp End Function Cheers, Stefan.

        All answers have a question? All code has an end.

        S Offline
        S Offline
        smguc
        wrote on last edited by
        #3

        Opps, Adjustments to above code... Replace 'txtPg7a.Text' with "o" and replace 'txtPg7p.Text' with "•" Sorry.. Cheers, Stefan.

        All answers have a question? All code has an end.

        H 1 Reply Last reply
        0
        • S smguc

          Opps, Adjustments to above code... Replace 'txtPg7a.Text' with "o" and replace 'txtPg7p.Text' with "•" Sorry.. Cheers, Stefan.

          All answers have a question? All code has an end.

          H Offline
          H Offline
          hsprasain
          wrote on last edited by
          #4

          Hey I repalced whatever you have told me but I still get some compile errror? What exactly o and . are doing? and it also gave me some erros on other parts of code. Is the code written in VB.NET?

          S 1 Reply Last reply
          0
          • H hsprasain

            Hey I repalced whatever you have told me but I still get some compile errror? What exactly o and . are doing? and it also gave me some erros on other parts of code. Is the code written in VB.NET?

            S Offline
            S Offline
            smguc
            wrote on last edited by
            #5

            Hey, Sorry forgot to declare 'Sleep' Place this at the top of your module Option Explicit Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) The "o" and "." are use to show a progress in the status bar, the "." runs along the "o" to give you the progress. Hope this helps. Cheers. Was written in Visual basic

            "All answers have a question? All code has an end."

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups