VISUAL BASIC_6
 

4.  Projects using Intrinsic and Professional ActiveX Controls(3)


Running the Project:

On selecting the start button from the Run menu, the run mode window aoppears.   Now click the createlist button.   It will first create the first level list.   Then click the addfruit button.  The fruits list will be added at the second level..  Then click the addveg button.   The vegetables list will be added at the second level and the final window appears as shown in the figure 1.

2. Project using ProgressBar:

The ProgressBar Control is used to pictorially represent the progress of a lengthy computer operation, say file copying or doing complex computations etc.   An advancing rectangular bar will usually denote the progress.   Drag a ProgressBar Control, a Text box and a command button and locate them in the form as shown in the figure 3.


                               Figure 3

 Entering the code:

Open the code window of the PictureBox and enter the code as shown in the figure 3a.  Select the Start button from the Run Menu and click the start button.   The run mode window shows the progress of the computation by an advancing rectangular bar and comes to a stop when the computation is over.   The Text box shows the percentage of progress completed. The run mode window is shown in the figure 4.

 

Private Sub cmdStart_Click()

    ' Set minimum and maximum values for progress

    ProgressBar1.Min = 1

    ProgressBar1.Max = 5000

    ' Loop 5000 times

    For i = 1 To 5000

        ' Set current value to loop value so progress will show status

        ProgressBar1.Value = i

 Text1 = CStr(i / 50) + "%completed"

    Next i

    ' Tell user routine is complete

    MsgBox "Done", vbInformation, "Complete."

End Sub

 

                  Figure 3a

                             Figure 4


 

Copyright © 2001 Selfonline-Education. All rights reserved.