Solved

trackbar

Posted on 2004-09-26
3
168 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

739 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