You are on page 1of 22

DEPARTMENT OF TECHNICAL EDUCATION

ANDHRA PRADESH
Name of the faculty : G. Radha
Designation : Lecturer
Branch : CCP
Institute : 026 - SG Govt. Polytechnic, Adilabad
Year / Semester : III Year / V Semester
Subject : Visual Basic – I
Subject Code : CCP - 503
Topic : Understand designing the user
Interface
Duration : 50 Mts.
Sub Topic : common properties of the Controls
Teaching Aids : Animations & Images

CCP-503.9 1
Recap

 Designing a simple Form and display the messages


using Controls

CCP-503.9 2
Objectives
Upon the completion of this period you will be
able to

 Understand the common properties of the


Controls

 Enable, disable the Controls and run the


application

CCP-503.9 3
Controls & Properties

 Properties define the characteristics of a control


such as size, color etc

 Properties decide how a Control behaves

 Controls have some common Properties

CCP-503.9 4
Common Properties of Controls

 Name : This property sets the name of the


control through which you can
access control properties and
methods

 Appearance: It determines appearance of the


control

CCP-503.9 5
Common Properties of Controls
 Back Color : It sets the background color on
which the text is displayed or graphics
are drawn
 Font : This Property sets the face attribute
and size of the Font used for the text on
the Control
 Width & Height : These set the Control’s dimensions.

CCP-503.9 6
Common Properties of Controls

 Left & Right : These set the co - ordinates of the


control’s upper left corner, expressed
in the units of the container
 Enabled : Permits user’s access to the control at run

time
True - allows access
False – disallows access
CCP-503.9 7
Common Properties of Controls

 Visible : Decides whether a control is visible at


run time or not

CCP-503.9 8
Enabled and Disabled Property

 Enabled Property allows/disallows user to access the


control at run time
By default the Enabled Property of Controls is True
 Disabled Property means Control appears ‘grey’ and
can not accept user input
To disable a Control set Enabled Property of Control to
False

CCP-503.9 9
Application on Enabled and Disabled

 Open a new Standard-Exe Project

 Change its caption as “Testing the Enabled Property”

CCP-503.9 10
Application on Enabled and Disabled
Place two Command Buttons side by side in the
middle of the Form.
Change its properties as listed in the below table.

Control Property Settings


Command Button1 Name Cmdcolor1
Command Button1 Caption &Color1
Command Button1 Enabled True
Command Button2 Name Cmdcolor2
Command Button2 Caption &Color2
Command Button2 Enabled False
CCP-503.9 11
Enabled and Disabled Property

 Now double-click the first Command Button, then


the code editor will be opened

 Type following code in it

Private Sub Cmdcolor1_Click()


Form1.Backclor = VBGREEN
End Sub

CCP-503.9 12
Enabled and Disabled Property

 Right – click on the code editor window then pop-up


menu displayed.
 Choose Hide option. It will display the Form designer
windows
 Again Double-click on the second Command Button
and type following code
Private Sub Cmdcolor2_Click()
Form1.Backclor = VBRED
End Sub
CCP-503.9 13
Enabled and Disabled Property

Output
Now, run the application
VBGREEN will be applied to the Form as its Back Color
and VBRED will not be applied to the Form as its Back
Color

CCP-503.9 14
Enabled and Disabled Property (Form Design)

CCP-503.9 15
Enabled and Disabled Property (Run Time )

CCP-503.9 16
Enabled and Disabled Property
(After Execution )

CCP-503.9 17
Summary
We have discussed about:
 Common properties of Controls

 How to enable, disable the Controls and run


the application

CCP-503.9 18
Quiz
1. To enable or disable a control the property
used is :

A) Enabled Property
B) Visible Property
C) Caption Property
D) Hide Property

CCP-503.9 19
1. Which of the following is NOT a common
property for command button, Label and Text
Box

A) Caption
B) Name
C) Text
D) BackColor

CCP-503.9 20
Frequently Asked Questions
1. List any four common properties of the Controls
2. Write the procedure to enable, disable the Controls

CCP-503.9 21
Assignment
1. Create an application to show use of ‘enable’ property
at run time

CCP-503.9 22

You might also like