Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi on my form there is 2 text box (username and password) and image of car
if the user enter correct user name and password and press on login button the car will move from left to right (like the progressbar movement ) then another form will open how can i make the car move using vb.net?

i try this code but its wrong:
VB
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Static x As Integer = 5
        Static y As Integer = 0
        Static Flip As Integer = False

        If y Mod 2 = 0 Then
            Me.PictureBox1.Image = My.Resources.ferrari_icon
        Else
            Me.PictureBox1.Image = My.Resources.ferrari_icon

        End If
        If Me.PictureBox1.Left >= 500 Then
            x = -5
            Flip = True
        ElseIf Me.PictureBox1.Left >= 0 Then
            x = 5
            Flip = False
        End If
        If Flip = True Then
            Me.PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)

        End If
        Me.PictureBox1.Left = Me.PictureBox1.Left + x
        y += 1

    End Sub
Posted
Updated 29-Mar-12 2:33am
v3

1 solution

In what way is it wrong? It could be that all you need to do is refresh the picturebox at the end of the code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900