Page 31 - Open Soource Technologies 304.indd
P. 31
Unit 2: Working of VB Applications
Who Is the “User” of an ActiveX Control? Much of the documentation on
ActiveX custom controls employs the word “user” loosely, sometimes mean-
ing the end user of the application where your control is sited and, at other
times, meaning the developer who is programming with your control.
2.2 Method and Events
A method is an action that can be performed on objects. For example, a cat is an object. Its
properties might include long white hair, blue eyes, 3 pounds weight etc. A complete definition
of cat must only encompass on its looks, but should also include a complete itemization of its
activities. Therefore, a cat’s methods might be move, jump, play, breath etc. Similarly, in object
oriented programming, a method is a connected or built-in procedure, a block of code that can
be invoked to impart some action on a particular object. A method requires an object to provide
them with a context. For example, the word Move has no meaning in Visual Basic, but the
statement, Text1.Move 700, 400 performs a very precise action. The TextBox control has other
associated methods such as Refresh, SetFocus, etc.
• The Refresh method enforces a complete repaint of the control or a Form. For example,
Text1.Refresh refreshes the TextBox.
• The Setfocus method moves the focus on the control. For Example Text1.SetFocus sets the
focus to TextBox control Text1.
2.3 Event Procedures
An event procedure is a procedure block that contains the control’s actual name, an underscore(_),
and the event name. The following syntax represents the event procedure for a Form_Load event.
Private Sub Form_Load()
....statement block..
End Sub
Event Procedures acquire the declarations as Private by default.
How to create the Crystal Report in Visual Basic?
To access the Crystal Report Designer, a Start menu group and shortcut will have been
automatically created.
Lets have a quick look at the Designer
Initially there is one tab on the report - Design - when you select the print preview to see
how the report looks with data in, another tab named Preview will appear.
While you are in design mode you can draw and arrange the data fields on the report. This
is done in a similar way to creating controls on a form in VB.
LOVELY PROFESSIONAL UNIVERSITY 25