0% found this document useful (0 votes)
52 views22 pages

Vbcontrols

The document describes various properties, methods, and events of different user interface controls in Visual Basic, including textboxes, frames, checkboxes, option buttons, command buttons, shapes, listboxes, comboboxes, horizontal scrollbars, images, and common dialog boxes. It provides details on properties like name, text, enabled, visible, as well as methods like setfocus and events like click, change, gotfocus for different controls.

Uploaded by

harpreet_avtar
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 PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views22 pages

Vbcontrols

The document describes various properties, methods, and events of different user interface controls in Visual Basic, including textboxes, frames, checkboxes, option buttons, command buttons, shapes, listboxes, comboboxes, horizontal scrollbars, images, and common dialog boxes. It provides details on properties like name, text, enabled, visible, as well as methods like setfocus and events like click, change, gotfocus for different controls.

Uploaded by

harpreet_avtar
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 PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

Textbox properties

Displays information entered at design time by the user, or in code at run time.
 Name : Returns the name used in code to identify an object.
 Text: Returns/sets the text contained in the control.
 Enabled: Returns/sets a value that determines whether an object can respond to user-generated
events.
 Visible: Returns/sets a value that determines whether an object is visible or hidden.
 Allignment:Returns/sets the alignment of a control's text.
 Selstart:Returns/sets the starting point of text selected.
 Seltext: Returns/sets the string containing the currently selected text.
 Sellength:Returns/sets the number of characters selected.
 Maxlength: Returns/sets the maximum number of characters that can be entered in a control.
 Multiline: Returns/sets a value that determines whether a control can accept multiple lines of text.
 Passwordchar:Returns/sets a value that determines whether characters typed by a user or
placeholder characters are displayed in a control.
 Locked: Determines whether a control can be edited.
Textbox Methods

Setfocus: Moves the focus to the specified object.


Textbox Events
 Change:Occurs when the contents of a control have
changed.
 Click: Occurs when the user presses and then releases
a mouse button over an object.
 Double click: Occurs when the user presses and
releases a mouse button and then presses and releases
it again over an object.
 Gotfocus:Occurs when an object receives the focus.
 Lostfocus: Occurs when an object loses the focus.
 Keypress:Occurs when the user presses and releases
an ANSI key.
Frames Properties
 Name: Returns the name used in code to identify an object.
 Borderstyle:Returns/sets the border style for an object.
 Visible: Returns/sets a value that determines whether an
object is visible or hidden.
 Backcolor: Returns/sets the background color used to
display text and graphics in an object.
 Tooltip text: Returns/sets the text displayed when the
mouse is paused over the control.
 Caption:Returns/sets the text displayed in an object's title
bar or below an object's icon.
Check Box
 Name : Returns the name used in code to identify an
object.
 Enabled: Returns/sets a value that determines
whether an object can respond to user-generated
events.
 Value(VBchecked,VBUnchecked,VBgrayed):Return
s/sets the value of an object.
 Visible: Returns/sets a value that determines whether
an object is visible or hidden.
 Tabindex:Returns/sets the tab order of an object
within its parent form.
Option Buttons
 Name
 Enabled
 Value(true,false)
 Visible
 Tabindex
Command buttons properties
 Name: Returns the name used in code to identify an object.
 Caption: Returns/sets the text displayed in an object's title bar or
below an object's icon.
 Style:Returns/sets the appearance of the control, whether standard
(standard Windows style) or graphical (with a custom picture).
 Tooltip text: Returns/sets the text displayed when the mouse is
paused over the control.
 Enabled: Returns/sets a value that determines whether an object
can respond to user-generated events.
 Visible: Returns/sets a value that determines whether an object is
visible or hidden.
 Picture: Returns/sets a graphic to be displayed in a
CommandButton, OptionButton or CheckBox control, if Style is
set to 1.
Command buttonsMethods
 Setfocus
Command Buttons Events
 Click
 Double Click
 Dragover
 Gotfocus
 Lostfocus
 Mouse over
 Mouse up
 Mouse down
Shape Control Properties
 Name:Returns the name used in code to identify an object.
 Shape:Returns/sets a value indicating the appearance of a
control.
 Backstyle:Indicates whether a Label or the background of a
Shape is transparent or opaque.
 Bordercolor : Returns/sets the color of an object's border.
 Backcolor:Returns/sets the background color used to display
text and graphics in an object.
 Fillstyle:Returns/sets the fill style of a shape.
 Fillcolor:Returns/sets the color used to fill in shapes, circles,
and boxes.
Listbox Control
A ListBox control displays a list of items from which the user
can select one or more. If the number of items exceeds the
number that can be displayed, a scroll bar is automatically
added to the listbox control.If no item is selected, the ListIndex
property value is -1. The first item in the list is ListIndex 0, and
the value of the ListCount property is always one more than the
largest ListIndex value.
Listbox Control Properties
 List:Returns or sets the items contained in a control's list portion. The list is a string array in
which each element is a list item.
 Itemdata:Returns or sets a specific number for each item in a ComboBox or ListBox control.
 Listcount:Returns the number of items in the list portion of a control.
 Listindex:Returns or sets the index of the currently selected item in the control. Not
available at design time.
 Selcount:Returns the number of selected items in a ListBox control.
 Selected:Returns or sets the selection status of an item in a FileListBox or ListBox control.
This property is an array of Boolean values with the same number of items as the List property.
 Sorted:Returns a value indicating whether the elements of a control are automatically
sorted alphabetically.
 NewIndex:Returns the index of the item most recently added to a ComboBox or ListBox
control. Read only at run time.
 Multiselect:Returns or sets a value indicating whether a user can make
multiple selections in a FileListBox or ListBox control
Listbox Methods
 AddItem: Adds an item to a ListBox or ComboBox control
 Clear:Clears the contents of a ListBox, ComboBox, or the system Clipboard.
 RemoveItem : Removes an item from a ListBox or ComboBox control
 Setfocus: Moves the focus to the specified control or form.
Listbox Events
 Click
 Double Click
 Dragover
 Gotfocus
 Lostfocus
 Mouse over
 Mouse up
 Mouse down
 Scroll
Combobox Control
A ListBox control displays a list of items from which the user
can select one or more. If the number of items exceeds the
number that can be displayed, a scroll bar is automatically
added to the listbox control.If no item is selected, the ListIndex
property value is -1. The first item in the list is ListIndex 0, and
the value of the ListCount property is always one more than the
largest ListIndex value.
Combo Box Properties
A ComboBox control combines the features of a TextBox control and a ListBox
control—users can enter information in the text box portion or select an item
from the list box portion of the control.
 List:
 Itemdata:
 Listcount:
 Listindex:
 Selcount:
 Selected:
 Sorted:
 Text:
 Locked:
Horizontal Scroll Bar
Scroll bars provide easy navigation through a long list of items
or a large amount of information. They can also provide an
analog representation of current position. You can use a scroll
bar as an input device or indicator of speed or quantity—for
example, to control the volume of a computer game or to view
the time elapsed in a timed process.
HScrollbar Properties
 Value:returns or sets the current position of the scroll bar, whose return
value is always between the values for the Max and Min properties, inclusive.
 Largechange:Returns or sets the amount of change to the Value property
setting in a scroll bar control (HScrollBar or VScrollBar) when the user clicks the
area between the scroll box and scroll arrow.

 Smallchange:Returns or sets the amount of change to the Value property setting


in a scroll bar control when the user clicks a scroll arrow.
 Max:returns or sets a scroll bar position's maximum Value property setting
when the scroll box is in its bottom or rightmost position.

Min:returns or sets a scroll bar position's minimum Value property
setting when the scroll box is in its top or leftmost position.
Image control
We can Use the Image control to display a
graphic. An Image control can display a graphic
from a bitmap, icon, or metafile, as well as
enhanced metafile, JPEG, or GIF files.
Image Properties
 Stretch:Returns or sets a value indicating whether a graphic resizes to fit
the size of an Image control.

 Picture: Returns or sets a graphic to be displayed in a control.


 Loadpicture function:Loads a graphic into a form’s Picture
property, a PictureBox control, or an Image control.

 Image1.Picture= loadPicture(“c:\program files\abc.bmp”)


Common Dialog Box
 The common dialog control provides a standard set of dialog boxes for operations
such as opening and saving files, setting print options, and selecting colors and
fonts. The control also has the ability to display Help by running the Windows Help
engine.

 The common dialog control provides an interface between Visual Basic and the
procedures in the Microsoft Windows dynamic-link library Commdlg.dll.

 To create a dialog box using this control, Commdlg.dll must be in our Microsoft
Windows \System directory.

 You use the common dialog control in your application by adding it to a form and
setting its properties. The dialog displayed by the control is determined by the
methods of the control.

 At run time, a dialog box is displayed or the Help engine is executed when the
appropriate method is invoked; at design time, the common dialog control is
displayed as an icon on a form. This icon can't be sized.
Common Dialog Box
Methods
 ShowOpen Shows Open File
 ShowSave Shows Save As
 ShowColor Color
 ShowFont Font
 ShowPrinter Print
 ShowHelp Invokes Windows Help

You might also like