Solved

trackbar

Posted on 2004-09-26
3
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 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