Mr Programmers 0 Newbie Poster

Hi Everyone! :)

Hope someone can help me in this problem. :?:

Things I have:
Button1
Picturebox1 (Name: Block)
Timer1 (Interval: 100)
Label1, which has the MouseEnter event. The MouseEnter event is MoveToStart().
Panel1, which includes Picturebox1, Label1.
(The codes are at the bottom)

My Problem:
When Form1 debugs (runs), I click on Button1, which enables and starts Timer1. Picturebox1 (Block) starts moving right and then left and then right and then goes on. I have put a MouseEnter event on the Picturebox so when Picturebox1 is moving, and the mouse enters Picturebox1, a message box should appear. BUT, when Picturebox1 starts moving, Form1 stucks, message box doesn't appear, MouseEvent doesn't work, not on the Picturebox neither on Label1 and I have to stop the form from running. Label1 and Block (Picturebox1's name) are having the same MouseEnter event code which is MoveToStart(). MoveToStart()'s code is at the bottom.

My code:

Public Class Form1

Dim BlockX As Integer = 1

TIMER1:

If Block.Location = New Point(4, 237) Then
            Do Until Block.Location = New Point(499, 237)
                Me.Block.Left = Me.Block.Left + BlockX
                If Block.Location = New Point(499, 237) Then
                    Do Until Block.Location = New Point(4, 237)
                        Me.Block.Left = Me.Block.Left - BlockX
                    Loop
                End If
            Loop
        End If

I have put MoveToStart() in a label. And the label's MoveToStart() is Picturebox1's MouseEnter event.

MoveToStart():

MsgBox("You touched the line! Try again.", MsgBoxStyle.Information, "Line Touched!")
        Dim startingPoint As Point
        startingPoint.Offset(20, 28)
        Cursor.Position = PointToScreen(startingPoint)
        Panel1.Enabled = False
        Button1.Enabled = True

Button1:

timer1.enabled = True
        Timer1.Start()
        Button1.Enabled = False
        Panel1.Enabled = True

I know this is very complicated and if you want any further information please reply, but ANY help will be highly appreciated, thanks for your time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.