Advertisement

07.18.2008 at 11:58AM PDT, ID: 23577848
[x]
Attachment Details

How do I have a button repeat an action for as long as I have the button depressed?

Asked by indy500fan in Microsoft Visual Basic.Net

Tags: VB.NET, VS2005

Friends,

I tried the following, but it never stopped the process when I released the mouse button:

    Private Sub btnFaster_Hold(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnFaster.MouseDown
        While Control.MouseButtons() = Windows.Forms.MouseButtons.Left
            If tbSpeedThreshold.Value < 20 Then
                tbSpeedThreshold.Value += 1

                System.Threading.Thread.Sleep(500)
                If Control.MouseButtons. = Windows.Forms.MouseButtons.None Then
                    SetSpeedThreshold()
                    Exit Sub
                End If
            End If
        End While
    End SubStart Free Trial
[+][-]07.18.2008 at 12:10PM PDT, ID: 22038799

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 12:14PM PDT, ID: 22038834

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: VB.NET, VS2005
Sign Up Now!
Solution Provided By: jpaulino
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.18.2008 at 02:34PM PDT, ID: 22039999

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 03:01PM PDT, ID: 22040175

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628