You are on page 1of 41

m   

{Lecturer, Computer Engineering Department }


Ú uouse Events ::
1) Click Event ::
2) Double click event :
3) uouse Down event::
4) uouse Up event ::
5) uouse move event ::
6) Drag over and Drag drop event ::
1) uouse Click event ::
r This event triggers when user clicks any mouse button.
r It is fusion of ³mouse down´ and mouse up´ event.
r Syntax for click event is as follows «

Private sub text1_Click()

End sub
Ú uouse Double click event ::
r double click event is triggered when user double clicks
mouse button!
rFor example, if we what an event to be triggered when
double clicked a textbox,

Private sub text1_DblClick()

End sub
Ú uouse Down Event ::
rThis event is triggered when user presses any mouse button
and remains in the pressed state, i.e. button is not released!

Private Sub Command1_uouseDown(Button As Integer, Shift


As Integer, X As Single, Y As Single)
Label1.Caption = "mouse down!!"
End Sub
Ú uouse Up Event ::
rThis event is triggered when user presses and then releases
any mouse button!

Private Sub Command1_uouseUp(Button As Integer, Shift As


Integer, X As Single, Y As Single)

Label1.Caption = "mouse UP !!"


End Sub
Ú uouse move event ::
r This event is triggered when user moves mouse pointer to
another location on the screen..

Private Sub Command1_uouseuove(Button As Integer, Shift


As Integer, X As Single, Y As Single)
Label1.Caption = "mouse u ING .....!!"
End Sub
Ú Drag ver and Drag Drop ::
r Dragging is pressing the mouse button i.e. should remain in
pressed state move the control anywhere on the form «
rDrag ver :: When this dragged button is 

  , ³Drag over´ event occurs«
rDrag Drop :: when mouse button is  
  
  it is know as dropped and ³drag Drop´ event is
triggered.
rThis dragging and dropping occurs at r   not at
design time!
rDragging and dropping the controls does not change the
location of the control, its just that we can perform some
action when user performs it!
Ú Dragmode property ::
r By default for all objects Dragmode property is set to value
± 0- uANUAL
r Change it to ± 1- automatic«

Why so??
r For any object ! 

     that
object can not be dragged anywhere! 




r When its automatic, dragging and dropping is allowed!
Ú _eyboard events occurs when input is
giventhrough keyboard.

Ú For example pressing a key on keyboard


triggers ³key press´ event «

Ú As per the key pressed, different keyboard


events are triggered and , they are supported by
almost all visual basics controls«
1) _ey down Event ::
r this event is triggered when user presses arrow key on the
keyboard, i.e. it should remain in the pressed state.
2) _ey Up Event ::
r This event is triggered when user presses and releases
any key on the keyboard !
3) _ey Press Event ::
r This event occurs when user presses any key on
keyboard.
Private Sub Text1__eyPress(_eyAscii As Integer)
Label1.Caption = "key pressed in text box "
End Sub
1) _ey press event works when any key pressed!!
2) _ey Down works only when arrow key is
pressed..[ not released! ]
3) _ey down again works for all keys.. [key pressed
and released! ]
1) Form Load::
2) Form activate ::
3) Form Resize ::
4) Form terminate ::
5) Form Unload ::
1) Form load event ::
r Form load event is triggered when form is loaded either by
RUN or by SH W method..

2) Form activate event ::


r It is triggered after the form load event ,the code that must
be executed after once the form is loaded should be
written in form activate event «

3) Form Resize Event ::


r When user tries to change size of form using mouse, this
event is triggered.
4) Form terminate ::
r When all references to the form are terminated by going
out of scope this event is triggered..

5) Form unload ::
r Unloading or closing of form removes the form from
memory , but the code of that for remains as it is!
r When user closes the form or uses unload stetment, this
event is triggered.
1) Change ::
r This event is associated with textbox, Label and combo
box.
r This event occurs when user writes some text in the
control.

2) Got Focus ::
r This event is triggered when the object is selected.
r For example , text box is selected either by cliking it or
using text box.
r When an object is selected, we can say it G T F CUS«
3) L ST F CUS ::
r This event is triggered when the control is deselcted.
r For example, once we had selected a command button, so
it G T F CUS, now we selected a text box, fo command
button L ST F CUS and text box G T F CUS!
1) Textbox ::
r Name :
r Back color
r Enabled
r Font
r Forecolor {its color of text in textbox }
r Index { sets index for control array! }
r Locked { determines whether value of text box can be
edited or not ? True / false}
r uax length { it specifies max number of characters that
can be accpeted in text box }
r uultiline { true/ false}
Cont «
rPasswordchar { preferably special char - * $ @ # should be
used }
rTabIndex {sets tab order .}
rTabstop {true means text box will be selected using tab
space, FALSE means tab space cant be used for slecting
text box }
rText
rTooltiptext {whatever we write in it will be diplayed when at
run time mouse is paused at text box .}
risible { true/false }
2) Label ::
r Caption {display text on label }
r As discussed with textbox, nothing new..

3) Command button ::
r Cancel :: { true/false.. When true it can be selected using
ESC key }
r Default :: {true/ false . When true it can be selected using
ENTER key }
r Rest all same as text box properties «
4) Frames ::
r All properties same as text boc, no new property.

5) Checkbox ::
r alue :: { 0 ± unchecked, 1- checked , 2 ± grayed }
r All rest same as text box properties «

6) ption Button ::
r Style { 0 ± standard window style, 1- graphical with costum
picture or color. }
r alue { true or false }
r All rest same as text box properties «
*) Shape ::
r It is used for placing different shapes on the form«
r Shape property decides which shape will be placed«
0- Rectangle
1- Square
2- val
3- circle
4- rounded rectangle
5- Rounded square
r Draw mode specifies how object will be drawn ::
{ it has values ranging from 1 to 13 , where 13- copypen gives
continuous line and 6- invert gives dashed line and so on
«}
Ë) LINE ::
r It draws a line on the screen ..
r Draw mode :: as per shape property
r X1 ± starting X co-ordinate
r Y1- starting Y co-ordinate
r X2 ± ending X co-ordinate
r Y2 ± ending Y- Co- rdinate
ù) Image ::
r Its used to display an image on form ..
G D DAY !!

You might also like