Solved

trackbar

Posted on 2004-09-26
3
165 Views
Last Modified: 2008-02-26
Hello

My trackbar and progress bar need to have 10 increments each and when i move trackbar, progress bar needs to move to the same location.

I wrote the code below, but I can only move a trackbar with it only 1 increment and then it stucks. Can you please advise what is going wrong in here. Thank you

    Private Sub tbrSlide_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbrSlide.Scroll

        Do While tbrSlide.Value < tbrSlide.Maximum
            pbrPercentDone.Value = tbrSlide.Value
        Loop
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tbrSlide.Maximum = 10
        tbrSlide.Minimum = 0
        tbrSlide.TickFrequency = 1
        pbrPercentDone.Step = 1
        pbrPercentDone.Maximum = 10
        pbrPercentDone.Minimum = 0
    End Sub
0
Comment
Question by:Gipsy
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 30 total points
ID: 12153998
Why a do WHILE loop ? Or did i understand the Q wrong ?  

    Private Sub tbrSlide_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbrSlide.Scroll
        pbrPercentDone.Value = tbrSlide.Value
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tbrSlide.Maximum = 10
        tbrSlide.Minimum = 0
        tbrSlide.TickFrequency = 1
        pbrPercentDone.Step = 1
        pbrPercentDone.Maximum = 10
        pbrPercentDone.Minimum = 0
    End Sub
0
 

Author Comment

by:Gipsy
ID: 12154022
thank you, dont know why.....i just didnt think it is that simple! what about setting 10 increments, do you think the setup i have allows 10 increments?
0
 
LVL 14

Expert Comment

by:aelatik
ID: 12154033
don't understand what you mean with "increment" because that is already happening here.
But you can change every setting. But do it this way ( this way you only need to adjust the slider settings ) :


    Private Sub tbrSlide_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbrSlide.Scroll
        pbrPercentDone.Value = tbrSlide.Value
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tbrSlide.Maximum = 100
        tbrSlide.Minimum = 0
        tbrSlide.LargeChange = 10
        tbrSlide.SmallChange = 1
        pbrPercentDone.Maximum = tbrSlide.Maximum
        pbrPercentDone.Minimum = tbrSlide.Minimum
    End Sub
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now