Computer II: Programming with Visual Basic 6
SETTING THE PROPERTIES
Outline Name
Property Convention for Naming Controls Common Control Properties Setting the Control Properties
Name Property Most
important property of a control Returns the name used in the code to identify an object
Conventions for Naming Controls Starts
with a three-letter prefix Keep it short (use shortened form if possible) Descriptive of the function of the control Don’t use any spaces (use underscore instead) Mix small and capital letters
Prefixes for Common Controls
Form
– frm Label – lbl
Command Button – cmd
Textbox
– txt Check box – chk Combo box – cbo Image – img Picture Box – pic Option Button – opt List box - lst
Example lblMen u txtInp ut
cmdEqu al
Common Control Properties
Back
Color – sets the background color Border Style - sets the style of the border for an object Caption – sets the text to be displayed Enabled – sets a value that determines whether an object can respond to user generated events
Common Control Properties
Font
– sets the Font size and style of an object Fore Color – sets the color of the text Picture – sets a graphic to be displayed in a control Text – sets the text to be displayed on a text box (equivalent of the caption)
Setting the Property (Design Time) Select
the object Go to the properties window Look for the property you want to modify on the left column Modify the settings on the right column
Hands On Open
your Hands On 1 folder Open prjCalculator Change the name property of the controls