College of computer technology Information network department Programming with Visual Basic =================================================== Fundamentals of Visual Basic 6.0 Elements of the user interface The user interface is what appears in the application's window when it runs. It consists of various elements with which the user can interact and control the application. In the Visual Basic applications that we shall be learning about in this course, the first element of the user interface is the Form. This is the window displayed at runtime, and it acts as a container for all the other elements of the interface (see Figure bellow). 2: Fundamentals of Visual Basic 6.0 Elements of the user interface The user interface is what appears in the application's window when it runs. It consists of various elements with which the user can interact and control the application. In the Visual Basic applications that we shall be learning about in this course, the first element of the user interface is the Form. This is the window displayed at runtime, and it acts as a container for all the other elements of the interface (see Figure bellow). College of computer technology Information network department Programming with Visual Basic =================================================== ons of some common elements of the user interface found on the Toolsbox in the VB IDE 1 = Picturebox icon 10 = Timer control icon 2 = Label control icon 11(i) = Drive List Box icon 3 = Textbox control icon 11 (ii) = Directory List Box icon 4 = Frame icon 11 (iii) = Files List Box icon 5 = Command button icon 12 = Shapes control icon 6 = Checkbox icon 13 = Line control icon 7 = Option button/radio button icon 14 = Image control icon 8 = Combobox icon 15 = Data control icon 9 = Listbox icon 16 = OLE control icon The elements in the user interface are common to all Windows applications, and they are all shown as icons in the Toolbox when you are in the VB IDE at design time. The icons and names of the common user interface elements that you’ll be working with in this course are shown in the Toolbox, as reproduced in Figure above. Let’s quickly run through the controls shown in the Toolbox: 1. Picture Box: This control is used to display images, and the images are set with the Picture property. The Picture Box control supports a number of methods for generating drawings. 2. Label: This control displays text on a Form that the user can’t edit. Labels commonly identify other controls and can be transparent, so the text appears to be placed directly on the Form. You set the label’s text with the Caption property. College of computer technology Information network department Programming with Visual Basic =================================================== 3. Text Box: This control displays text that the user can edit at runtime. The Textbox control is a mini text editor, and its most important property is the Text property, which can set the text of the control or read the text that the user enters. 4. Frame: This control is used to draw boxes on the Form and to group other elements. 5. Command Button: This is the most common element of the Windows interface. A command button represents an action that is carried out when the user clicks the button. 6. Check Box: The Check box control presents one or more choices that the user can select. The checkbox control’s main property is Value, and it is 0 if the checkbox is cleared, and 1 if the checkbox is checked. 7. Option Button: Option buttons, or radio buttons as they are also called, appear in groups, and the user can choose only one of them. The option button’s main property is Checked, and it is True if the control is checked, and False if otherwise. The option button is a toggle. Every time it’s clicked, it changes status (from checked to cleared and back). 8. List Box: This control contains a list of options from which the user can choose one or more. Unlike a group of checkboxes or option buttons, the list box control can contain many lines and the user can scroll the list to locate an item. The selected item in a list box control is given by the Text property. 9. Combo Box: This control is similar to the list box control, but it contains a text edit field. The user can either choose an item from the list or enter a new string in the edit field. The item selected from the list (or entered in the edit field) is given by the control’s Text property. 10. Timer: You can use this control to perform tasks at regular intervals. The main property of the Timer control is Interval, which determines how often the Timer notifies your application. If the Interval property is set to 1000, the Timer control issues a Timer event every 1 second. 11. File System Controls: These controls are used to add file-handling capabilities to your applications. They are normally used together to provide an interface for accessing and exploring drives, folders, and files. The File System controls are: (i) Drive List Box: This control displays the drives on the system in a drop-down list from which the user can select. (ii) Directory List Box: This control displays a list of all folders in the current drive and lets the user move up or down in the hierarchy of the folders. (iii) File List Box: This control displays a list of all files in the current folder.