Results 1 to 3 of 3

Thread: [RESOLVED] Using For Next Loops To Properly Shift a PictureBox up or Down

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    8

    Resolved [RESOLVED] Using For Next Loops To Properly Shift a PictureBox up or Down

    Hiya,

    Ive been struggling for a while trying to figure how out to Properly Move an object up or down using a For next loop, here is my current set up
    Code:
     Private Sub Shift()
    
            For intX_direction = 0 To Me.ClientSize.Width
    
                picBall.Left = intX_direction
            Next
    
            For intY_direction = 0 To Me.ClientSize.Height
    
                picBall.Top = intY_direction
            Next
    and that code is then called upon in a Do loop
    Code:
       Private Sub picBall_Click(sender As Object, e As EventArgs) _
            Handles picBall.Click
            intX_direction = _RIGHT
            intY_direction = _UP
            Do
                Shift()
    
                If picBall.Left + picBall.Width > Me.Width Then
                    intX_direction -= intX_direction
    
                ElseIf picBall.Left + picBall.Width < Me.Width Then
                    picBall.Left = 0
    
                End If
    
                If picBall.Top + picBall.Height > Me.Height Then
                    picBall.Top = intY_direction * -1
    
                End If
    
            Loop Until picBall.Left < 0
    I apologize for my lack of knowledge before hand, Im still learning
    Last edited by Shaggy Hiker; Oct 27th, 2017 at 06:32 PM. Reason: Added CODE tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width