VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



The easiest way to write slider bar code. Constructive criticism are accepted, you can reach throug

by okoji cyril chidi (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 22nd March 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

The easiest way to write slider bar code. Constructive criticism are accepted, you can reach through [email protected]

Rate The easiest way to write slider bar code. Constructive criticism are accepted, you can reach throug



' Add one label for the slider
' Add Microsoft common control 6.0 from Component menu item
' from the Project menu bar
' Finally add two command buttons
'....The first command button should be captioned Forward and
' the other End


Dim num As Long
Private Sub Command1_Click()
 'call the slider routine
  Slider1_Click
End Sub

Private Sub Command2_Click()
       DoEvents ' enable mouse while processing clic
       End ' terminate the program
End Sub


Private Sub Slider1_Click()
   Dim t As Double, m(20000) As Double
    ' you can read the content of a file, process the file, process an image
    ' and lot more
    ' or using any other routine that requires keeping
    ' the user alive
    If Command1.Caption = "Foreward" Then
       num = 0
       Slider1.Max = 20000  ' is the maximum record/file
       ' as the case may be
       Do While num <= Slider1.Max - 1
       ' ASSUMING you want to read the content of a file or process
       ' a file the code should be here for example
       'If EOF(1) Then Exit Sub
       'Input #1, m,.....
       '.......more codes for the processing continue within
       ' the do loop
       num = num + 1 ' increament the counter
       If num <= Slider1.Max Then
          Slider1.Value = num  ' assign the counter to the
          ' slider bar value
          ' it is this property that realy does the animation
       End If
       Form1.Caption = num & "  Number At " & Str(Int((num / Slider1.Max) * 100)) + " %"
       ' display the slider bar percentage in the form's caption
       DoEvents ' enable mouse while processing click
       Loop
     '  Close
       Command1.Caption = "Reverse"
       ' toggles the push button
    
     Else
      ' reverse the direction of the sliderbar
      num = 20000 ' The highest value or maximun value
      Slider1.Min = 1 ' get the minimum value of the
      ' slider bar
      Do While num >= Slider1.Min
      num = num - 1  'start decreasing the slider
      ' bar from the right hand side
      If num >= Slider1.Min Then
         Slider1.Value = num
           
      End If
      'For h = 1 To 10000000: Next h
      ' there may be  a need for  a delay if the operation is small
      Form1.Caption = num & "  Number At " & Str(Int((num / Slider1.Max) * 100)) + " %"
     ' display the slider bar percentage in the form's caption
    DoEvents ' enable mouse while processing clic
    Loop
    Command1.Caption = "Foreward" ' toggles the caption again
                                  ' base on the operation
    End If
End Sub


Download this snippet    Add to My Saved Code

The easiest way to write slider bar code. Constructive criticism are accepted, you can reach throug Comments

No comments have been posted about The easiest way to write slider bar code. Constructive criticism are accepted, you can reach throug. Why not be the first to post a comment about The easiest way to write slider bar code. Constructive criticism are accepted, you can reach throug.

Post your comment

Subject:
Message:
0/1000 characters