Progress bar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muddasirmunir
    Contributor
    • Jan 2007
    • 284

    Progress bar

    i am using vb6

    i have a follwing code which insert data into the table

    Code:
     
     
    ‘ Note fromint and toint can be any interger like 10000 -12000 inputed by user
     
     
     
    For a = fromint To toint
     
    Dim numberstr As String
     
    Dim numbercmd As Command
     
    Set numbercmd = New Command
     
    numberstr = "INSERT INTO invtemp	([Invoice No]) VALUES	 (" & a & ")" ‘There are more field but I remove them to simplify it
     
    numbercmd.ActiveConnection = con
     
    numbercmd.CommandText = numberstr
     
    numbercmd.Execute 
     
    End If
     
     
     
    Next a

    the code is working fine and now i want to add a progrss bar to it so i can show user how much time it takes
    proviosly i have no experien using a progress bar

    i had try it my making like this

    Code:
     
     
    ‘ Note fromint and toint can be any interger like 10000 -12000 inputed by user
     
     
     
    [b][i]ProgressBar1.Min = fromint[/i][/b]
    
    [b][i]ProgressBar1.Max = toint [/i][/b]
     
    For a = fromint To toint
     
    Dim numberstr As String
     
    Dim numbercmd As Command
     
    Set numbercmd = New Command
     
    numberstr = "INSERT INTO invtemp	([Invoice No]) VALUES	 (" & a & ")" ‘There are more field but I remove them to simplify it
     
    numbercmd.ActiveConnection = con
     
    numbercmd.CommandText = numberstr
     
    numbercmd.Execute
     
    [b][i]ProgressBar1.Value = ProgressBar1.Value + 1[/i][/b]
     
    End If
     
     
     
    Next a


    but it is giving me error on minimum value

    how to slove this
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Slight Tricky over here...
    Always For progressbar, Max value should be Greater than Min, Or else, it errorrs..
    So you need to reverse the condition... First Set Max and then Min, or First set Min =0

    ProgressBar1.Mi n = 0
    ProgressBar1.Ma x = 12000
    ProgressBar1.Mi n = 10000


    Regards
    Veena

    Comment

    • muddasirmunir
      Contributor
      • Jan 2007
      • 284

      #3
      OK I will try it like this by reversing it



      Originally posted by QVeen72
      Hi,

      Slight Tricky over here...
      Always For progressbar, Max value should be Greater than Min, Or else, it errorrs..
      So you need to reverse the condition... First Set Max and then Min, or First set Min =0

      ProgressBar1.Mi n = 0
      ProgressBar1.Ma x = 12000
      ProgressBar1.Mi n = 10000


      Regards
      Veena

      Comment

      • muddasirmunir
        Contributor
        • Jan 2007
        • 284

        #4
        Thanks its now working properly

        Comment

        Working...