Controls
Common properties Height – Height of the control Left – Left of the control Width – width of a control Top - From the screen top Font – Foreground color Name – It is used to identify the control in the code Backcolor – background color Enabled – whether user can access or not Visible – Whether it is visible to the user Appearance – Graphical or standard
Label It is a graphical control that is used to display text. This text cannot be edited directly. Properties: Caption : This is used to change the text displayed in the control. Autosize :This causes the control to horizontally expand and adjust to the size of the contents. Two values are allowed : true or false Wordwrap : This is used to resize the text entered in the caption property.If the text exceeds, the text wraps in the next line.
Command Button It is also known as push button. It is used to begin,interrupt or end a particular process. Access keys can e attached to that by placing an ampersand before the character. Properties: Caption : This property determines the text displayed on the command button. Backcolor : Only available with Graphical style. Style : It is used to create graphical buttons. Value o means standard, 1 means Graphical Picture : We can load images into a button Event : Click
Textbox A text box is used to accept information from user at runtime, can also be used to display text that user can edit at runtime. It can be used with the data control to display information from a database. Properties : Multiline : It is used to write multiple lines. It can be true or false Alignment : It can be used to set the alignment of text within the textbox. Values : Left, Right, Center
Checkbox It is used to give the user true or false option. It is used to select one more option from the choices. Properties : Caption – It specifies the text appears beside the checkbox Value : This is used to specify the state of a checkbox. 0 means deselected and 1 means selected Events : Click event
Option Button It is a round radio button that you select to turn an option on or off. Properties : Value : This property returns or sets the state of the option button Caption : It specifies the text that appears beside the option button Events : Click
Frame Control It is a container for other controls typically option buttons or check boxes. Caption : it specifies the text to be displayed as the caption Enabled : It is used to determine whether control can respond to user generated events.
List Box This control displays a list from which user can select one or more items. User can’t edit the data in the listbox directly. VB adds the scroll bar when the list is too big. Properties: Listcount : It returns the number of items in the list List index : Index of the selected item in the list. Index starts with zero List : This is an array holds the list’s item.List(0) holds the first item Multiselect : Simple
Methods : Additem : to add the items in the runtime. removeitem: to remove a particular item clear : It clears the entire listbox Events : Click
Combo Box It comes from combination of list and textbox. User can either enter data in the textbox or select an item from the list box. It can also be used to create a drop down list box.
Picture and Image Control The Image control displays graphics on your Form window. The graphics reside in a file, and the Image control determines how that file's graphic image will appear onscreen. The Picture Box control works almost exactly like the Image control, with these exceptions: The Picture Box control supports more properties, events, and methods than the Image control. The Picture Box control consumes more resources than the Image control and, therefore, is not as efficient.
Data types supported by Image.bmp A Windows bitmap image file.cur An animated cursor.dib An older bitmap image format.emf An enhanced Windows metafile extension.gif A Graphic Interchange Format file often used on Web pages.ico An icon file.jpg The JPEG image format that stores graphics in a highly compressed format.wmf A Windows metafile
Differences between two Image Control It takes less resources. Refresh rate is higher The Image control shrinks and grows It cannot be added in MDI Picture Control It takes more resources. Refresh rate is lower The Picture Box control automatically clips the image if it will not fit within the Picture Box control's borders that you set when you placed the Picture Box control. It can be added in MDI
Image control Properties : Picture : To load the picture in the control Stretch : whether graphic image has to be resized or not Picture control : Picture : To load the picture in the control Autosize : Whether the control has to be resized or not Method : Loadpicture Event: click
Scrollbar Scrollbars let users control value changes. The toolbox includes both a Horizontal Scrollbar and a Vertical Scrollbar control. Large Change Specifies the amount that the scrollbar changes when the user clicks within the scrollbar's shaft area. Max Indicates the maximum number of units that the scrollbar value represents at its highest setting. The range is from 1 to 32,767 (the default Max value).
Min Indicates the minimum number of units the scrollbar value represents at its lowest setting. The range is from 1 (the default Min value) to 32,767. SmallChange Specifies the amount that the scrollbar changes when the user clicks an arrow at either end of the scrollbar. Value Contains the unit of measurement currently represented by the position of the scrollbar. Events : Change() : when the value changes Scroll() : When we drag the thumb
Timer control The Timer control always works in the background, and the user never sees the timer on the form in the runtime. The timer's purpose is to work in the background, triggering an event every once in a while according to the clock ticks. Properties : Interval : in millisecond Enabled : Whether timer event to be occurred or not Events : Timer()
File controls Drivelistbox : It lists the existing drives from the system Property : Drive At runtime, you can set the drive list box's Drive property. The Drive property will contain the name of the drive as well as the volume label on the drive. Dirlistbox : It shows the directories according to the drive. Property Path At runtime, you can set the directory list box's Path property. The Path property contains the name of the disk drive as well as the full path. Events : Change()
Filelistbox: It lists out the files existing in the particular directory. Properties : Pattern :Contains a wildcard pattern of files. * in the pattern indicates all files, and ? means all characters. Filename : It shows the name of the file. Path : It returns the path of a particular file.
Shape It is used to draw different shapes. Property : Shape : It determines the shape 0 – Rectangle 1 – Square 2 – Oval 3 – Circle 4 – Rounded Rectangle 5 – Rounded Square
Line Used to draw the line Properties : Border Width – Thickness of the line BorderStyle – Type of Line 1 – Solid 2- Dash 3 – Dot etc..
Listbox and combobox: It provides a set of choices that are displayed vertically in a single column.Scrollbars appears automatically if the list exceeds the size. Combobox combines the feature of textbox and a Listbox.This control enables the user to type a text or selecting from the list. Scrollbar : It enables the user to select a value by positioning it at the desired location.
Common Properties Apperance Back Color Height Width Font Picture Tabindex Tabstop
Textbox Max characters:2048 chracters or 32kb (multiline property true) Text maxlength Sellength Seltext Passwordchar Multiline(read only only at design time)
Advanced controls Common Dialog Control:It provides services to the application like open,save,save as,Font Statusbar: It is a control that displayed at the bottom of the application and displays the current state of the application. Imagelist: It is basically list of images.it stores a collection of pictures.It doesnot contain anything visible at runtime. Treeview :It is used to display information within a tree hierarchy.A treeview is made up of nodes that are related to each other. Progrssbar: It gives the user some visual feedback on what’s happening during a time consuming operation.
To display various dialog Boxes: ShowOpen: Action property :1 Showsave : Action property :2 ShowColor : Action property :3 showFont : Action property :4 Showprinter : Action property :5 ShowHelp: Action property :6
Read Only properties Textbox : name, multiline,hideselection,hwnd,index,scrollbars Listbox : Name, index, hwnd, sorted, style, mulitselect Listcount, selcount, newindex Combobox : name,hwnd, index, listcount, selcount, newindex,sorted