
If mousemovecount = 0 Then 'if event does not occur yet then display message Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) To see click event we have to disable msgbox on mouse move event if it occurred more than once. For example, when you what to click form, you move mouse and mouse move event occurs. Some time, we have to disable message box on an event to be able to see the next event. For example, in Form_Activate() procedure we place message "Form Activate event" in Form_Load() procedure "Form load event" and so on. To see what event occurs, we place Message Box procedure in each event procedure with a message, which tells which event occurs. I initialized all count variables on form load event.

If you write frmMain.BackColor = &H8000000A in the form_initialize event procedure, it will not work, because form is not loaded and backcolor property does not exist yet. If you want to change form appearance (backcolor or text color etc.) then the best way is to place the code performing this change inside the form_activate procedure. If you open any other window and close it, the form will redraw itself and paint event occurs again. Form initialization is the first event that occurs when form is loaded, then form load event occurs, then paint event, then got focus, the last event is activated. It is important to know the sequence of events when form is loaded or unloaded. Purpose of this counting you will understand later. These variables will be used to count each event. Variable declarations and paste them under the Option explicit text The FormEvent frmMain code window will be displayed. This icon will be displayed when user drag the image.ĭouble click the form. In the common folder select Graphics, Icons and select any icon you like. In Load Icon dialog go one level up and select the Common folder. Select DragIcon properties and click browserīutton on the right. It allows you to drag image around the form.

Select image and find DragMode line in the Properties image1 window. Select image control from toolbox on the left and draw the image on the frmMain form.

The (Name) line in Properties Project1 window in the right lower corner and type your project name Select Project Project1 in the Project Project1 window in the righ upper corner. Double click the Caption line and type frmMain. Double click the (Name) line on the Properties Form1 window and Open Visual Basic development environment and select Standart.EXE project from the New Project I will show you what events form has and how to use this events in Visualīasic application. In the lesson 2 you will learn formĮvents and properties. How to use Visual Studio to create a simple VB project. In the lesson 1 Start VB you have learned Hover mouse over a thumbnail to see a large image. Computer Programming Web programming Tips
