0% found this document useful (0 votes)
240 views31 pages

VB13

This document discusses various objects in Visual Basic and their properties. It describes the properties of text boxes, labels, command buttons, frames, checkboxes, option buttons, shapes, lines, and images. It also covers working with multiple objects, keyboard access keys, color properties, changing fonts in code, and using the With/End With block to set multiple properties of an object at once.

Uploaded by

bhumika_shah7
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
240 views31 pages

VB13

This document discusses various objects in Visual Basic and their properties. It describes the properties of text boxes, labels, command buttons, frames, checkboxes, option buttons, shapes, lines, and images. It also covers working with multiple objects, keyboard access keys, color properties, changing fonts in code, and using the With/End With block to set multiple properties of an object at once.

Uploaded by

bhumika_shah7
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Visual Basics …

[Lecture 13 ]

Bhumika Shah
{Lecturer, Computer Engineering Department }
Object with specific properties ::
1) Textbox ::
 Name :
 Back color
 Enabled
 Font
 Forecolor {its color of text in textbox }
 Index { sets index for control array! }
 Locked { determines whether value of text box can
be edited or not ? True / false}
 Max length { it specifies max number of characters
that can be accpeted in text box }
 Multiline { true/ false}
Cont …
 Passwordchar { preferably special char - * $ @ # should
be used }
 TabIndex {sets tab order .}
 Tabstop {true means text box will be selected using
tab space, FALSE means tab space cant be used for
slecting text box }
 Text
 Tooltiptext {whatever we write in it will be diplayed
when at run time mouse is paused at text box .}
 Visible { true/false }
2) Label ::
 Caption {display text on label }
 As discussed with textbox, nothing new..

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

5) Checkbox ::
 Value :: { 0 – unchecked, 1- checked , 2 – grayed }
 All rest same as text box properties …

6) Option Button ::
 Style { 0 – standard window style, 1- graphical with custom
picture or color. }
 Value { true or false }
 All rest same as text box properties …
7) Shape ::
 It is used for placing different shapes on the form…
 Shape property decides which shape will be placed…
0- Rectangle
1- Square
2- Oval
3- circle
4- rounded rectangle
5- Rounded square
 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 … }
8) LINE ::
 It draws a line on the screen ..
 Draw mode :: as per shape property
 X1 – starting X co-ordinate
 Y1- starting Y co-ordinate
 X2 – ending X co-ordinate
 Y2 – ending Y- Co-Ordinate
9) Image ::
 Its used to display an image on form ..
 To select image , we need to select image box first.
 Second we need to change “Picture” property of
image , as we click on it, it gives us dialog to select a
picture.
 Select desired picture and click open..
 Selected image will be set on form …
Working with Multiple Objects …
 To set common properties or to perform
some task in group , we can select multiple
Objects [ not necessary of the same type! ].

 How to select multiple controls ?


 using control key – press control key and now
select multiple objects..
By dragging the mouse - click on left top corner
and drag mouse till right bottom corner in a way
that all desired objects are selected as a group..
 We can also select multiple objects and press DELETE to delete all
selected object at once!

 When multiple objects are selected, we can change properties of them


all at once!
 For example, backcolor, font,height, appearance etc..
 But name cant be same so when multiple objects selected, property window don’t
show name property!

 All selected [ multiple objects at a time] objects can be moved to any other
location by dragging them all in a group together!

Multiple objects can be aligned together by –


Format -> allign -> left/center/right/top/middle/bottom/ grid
Twips …
 Twips are default measuring unit of Vb
 1 twip = 1/1440 of an inch
 So an object 1 inch wide will be 1440 twips

wide!

 To change measurement from twips to


inches/centimeters/pixels etc…
 select a form, go to its form properties, and select
scale mode …
Key board access keys…
 Keyboard access keys are simply short cut keys for any
command!
 For example in word we use ALT+F – to open file

menu!
 In visual basics we can assign such keyboard acess

keys as and when required!


 Syntax ::

for example if we have “ENTER” key and we want to


assign ALT+E to it,
Simply in caption of object write -- &ENTER
Means without clicking with mouse, just by pressing
ALT+E Enter button will be pressed!
COLOR property in VB…
 Either for backcolor or for forecolor in VB we
need to use color information!
 It can be either selected from property window or

can be assigned by coding!


 If done by coding, colors can be assigned as..

 vbRed, vbBlue, vbYellow,vbGreen


 vbBlack,vbWhite,vbMagenta, vbCyan
 for example…
Text1.BackColor= vbRed
{ will set background color of text1 to RED..}
Changing fonts while coding….
 Text1.FontBold = true
 Text1.FontItalic = true
 Text1.FontUndeline = true
 Text1.FontName = “Comic Sans MS “
 Teaxt1.ForeColor = vbRed
With….. End with
When we want to change multiple properties of
same object at code time, we need to write
Objectname . Propertyname multiple times…

 With.. End with can be used to avoid it..


With objectname
. Property1name = value1
. Property2name = value2
. Property3name = value3
. Property4name = value4
End With
Private Sub Command1_Click()
With Label1
.ForeColor = vbRed
.FontUnderline = True
.FontBold = True
.FontItalic = True
.FontSize = 20
.Caption = "with .. .end with used! "

End With

End Sub
GOOD DAY !!

You might also like