VB Default Controls List Box, Combo Box

Slides:



Advertisements
Similar presentations
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Advertisements

Working with Intrinsic Controls and ActiveX Controls
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
List box & Combo box controls School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 14, Monday 4/21/2003)
1 Visual Basic Programming II Lecture 3 MIS233 Instructor – Larry Langellier.
1 Lab6 Lab6 ComboBox Control Properties, Methods and Events.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Programming Based on Events
Using String Functions Left(str, nchars) - extract left nchars Right(str, nchars) - extract right nchars Mid(str,start,[nchars]) - get middle chars.
Lab4 ListBox Control Properties, Methods and Events.
ListBoxes The list box control allows the user to view and select from multiple items in a list. CheckedListBox control extends a list box by including.
Group Boxes and Panels Arrange components on a GUI Buttons and etc. can be placed inside a group box or panel. All these buttons move together when the.
CVEV 118/698 Visual Basic Lecture 3 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Lec4 P 1 CP2030 Visual Basic For C++ Programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 4 Back To Index v Iteration - Looping v Arrays.
Slide 1 VB Default Controls Text Box, Check Box, Option Button & Frames.
Controls General Discussion. VB Controls Visual Basic Controls A control is the generic name for any object placed on a form Controls may be images,
Tutorial 7: Sub and Function Procedures1 Tutorial 7 Sub and Function Procedures.
BIM313 – Advanced Programming Simple Controls 1. Contents Traditional Controls – Labels, Text Boxes, Buttons, Check Boxes, List Boxes, Combo Boxes Advanced.
Teach Yourself Windows 98 Module 2: Working with Files, Folders, and the Desktop.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Ch 11: Userforms CP212 Winter Topics Designing User Forms o Controls Setting Properties o Tab Order o Testing Writing Event Handlers o Userform_Initialize.
1 Graphical User Interfaces Part 2 Outline ListBoxes and CheckedListBoxes ListBoxes CheckedListBoxes ComboBoxes.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
110 M - 1 ListBoxes & ComboBoxes Provide a list for the user to select from Various styles, choose based on –Amount of data to be displayed –Space available.
ACCESS Part 2. OBJECTIVES  Use the Form Wizard  Create a split form  Use Form Layout View  Add fields to a form  Modify form controls  Create calculations.
Mouse Events. Mouse Driven Events Unlike control_click() which is passed no arguments (unless it's an index for an array), MouseDown, MouseUp and MouseMove.
Copyright © 2001 by Wiley. All rights reserved. Chapter 5: The Repetition Process in Visual Basic Event Driven Loops Determinate Loops Indeterminate Loops.
The Repetition Process in Visual Basic. The Repetition Process The capability to repeat one or more statements as many times as necessary is what really.
CIS 338: VB.NET Components Dr. Ralph D. Westfall April, 2011.
Chapter 9 - VB.Net by Schneider1 Chapter 9 – Additional Controls and Objects 9.1 List Boxes, Combo Boxes, and the File-Opening Control The List Box Control.
ListBox, ComboBox, Menu Chapter 5.4, ComboBox Control: Properties & Methods u Combines TextBox features with a short drop- down list  cboOne.AddItem(string)
1. Chapter 4 Customizing Paragraphs 3 More Paragraph Changes Highlight a paragraph in Word by applying borders and shading. Sort paragraphs to control.
Working with option button, check box, and list box controls Visual Basic for Applications 13.
COMPREHENSIVE Access Tutorial 6 Using Form Tools and Creating Custom Forms.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
© 1999, by Que Education and Training, Appendix A, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
1. Chapter 6 Formatting Pages 3 Formatting Changes in Word You can use views other than the default Print Layout view when working with page design.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
CS 101 Test 2 Study Guide Acronyms RAD - Rapid Application Development IDE - Integrated Development Environment GUI - Graphical User Interface VB - Visual.
An Inspiration Software Tutorial INDEX Changing a Symbol in Inspiration Adding a Symbol in Inspiration Moving a Symbol in inspiration Adding text under.
Chapter 7 P 1 Lists and Loops List boxes and combo boxes List box - list of items - useful for a list which does not change Combo box - list of items -
Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Chapter 8.  Visual Basic includes several built-in mathematical functions ◦ Abs ◦ Sqr ◦ Sgn ◦ IsNumeric ◦ Round ◦ Format ◦ Pmt ◦ PV ◦ FV.
7-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al- ajmi Chapter 3 Some Visual Basic Controls and Events Visual Basic. NET.
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.
AdditionalControls 1. The MenuStrip 2 Double-click Let’s begin to design the menu bar for VB! Let’s begin to design the menu bar for VB! 3.
 A ListBox control displays a list of items and allows the user to select one or more  Drag from Toolbox to create this control on a form.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code that may be executed several times. Fixed-count (definite) loops repeat a fixed.
Unit 6 Repetition Processing Instructor: Brent Presley.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked.
Basic GUI VISUAL BASIC. BASIC GUI Slide 2 of 53 Topic & Structure of the lesson Introduction Data Validation Use controls for making choices Write Pull.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code (loop body) that may be executed several times. Fixed-count (definite) loops repeat.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
1 Dynamic Arrays ListBoxes, Dynamic Arrays, Dynamic Control Arrays ListBoxes are on pp and dynamic arrays are in Chapter 7 of Deitel, Deitel and.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
ListBox and ComboBox Controls 7.5 – Book One on the computers.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Apply Procedures to Develop Menus, List Box and Combo Box Objects
The List Box Control Items can be placed into the list at design time or run time The Sorted property causes items in the list to be sorted automatically.
Introduction to Problem Solving and Control Statements
Lecture Set 10 Windows Controls and Forms
Data Types List Box Combo Box Checkbox Option Box Visual Basic 6.0
Creating Additional Input Items
Presentation transcript:

VB Default Controls List Box, Combo Box

Default Controls

List Box ListBox control can used the to present a list of choices. The key parts of the list box are the following: Item list: This is the list of items from which the users can select. These items are added to the list in the design environment or by the program as it is running. Selected item: This item is chosen by the users. Scrollbar: This part indicates that more items are available on the list than will fit in the box.

Adding Items to List Box at design-time List box items can be added at design time by using the “List” property of the control. After you add an item to the list, press Ctrl+Enter to move to the next line of the list.

Adding Items to List Box at Programmatically Using addItem method: Example: Private Sub Form_Load() Dim i As Integer For i = 1 To 100 List1.AddItem “This is item “ & i Next i End Sub

Other List Box Methods & properties To clear all the items in a list box, use the Clear method: List1.Clear To refer to a list item use the list() array: List1.list(0) First Item List1.list(1) Second item ListCount represents the number of items in a list box. For i = 0 To List1.ListCount - 1 Print List1.List(i) Next i

Other List Box Methods & properties ListIndex property represents the selected item. Listindex is –1 if no item is selected. Msgbox List1.List(List1.ListIndex) Text property contains the selected item text, If no list box item has yet been clicked, the Text property contains an empty string (“”). MsgBox List1.Text To remove items from the list box, use the RemoveItem method: List1.RemoveItem List1.ListIndex

List Box Items Position To add an item in a specific position (index): lstAvailable.AddItem “Apples”, 2 To sort list box item, set the Sorted property to True. (designtime only)

Appearance of a List Box Style property: Standard Checkbox Columns property: 0 for single columns 1,2,3,… for the number of columns appearing at one time

Working with Multiple Selections MultiSelect property allows the user to select more than one item: 0 : None only one selection at a time 1 : Simple users can click an item with the mouse to select it or click a selected item to deselect it 2 : Extended users can select a range of items by clicking the first item in the range and then, while holding down the Shift key, clicking the last item in the range; all items in between the first and last item are selected. To add or delete a single item to or from this selection, users hold down the Ctrl key while clicking the item.

Working with Multiple Selections ListIndex property works only for a single selection You have to examine each item in the list to determine whether it is selected. Whether an item is selected is indicated by the list box’s Selected property. True (item selected) False (Item not selected) Example: For I = 0 to List1.ListCount - 1 If List1.Selected(I) Then Print List1.List(I) Next I

Keeping Other Data in the List ItemData property of a list box is an array of long integers, one for each item that has been added to the list box. NewIndex property contains the index number of the most recently added item in the list. lstCCode.AddItem “Egypt” lstCCode.ItemData(lstCCode.NewIndex) = 20 lstCCode.AddItem “Saudi Arabia” lstCCode.ItemData(lstCCode.NewIndex) = 966 Retreving the Data of an Item: Msgbox lstCCode.ItemData(lstCCode.ListIndex)

The Combo Box Enables you to present lists to the users can be used in three different forms: The drop-down combo box: Presents the users with a text box combined with a dropdown list. The users can either select an item from the list portion or type an item in the text box portion. The simple combo box: Displays a text box and a list that doesn’t drop down. the users can either select an item from the list portion or type an item in the text box portion. The drop-down list: Displays a drop-down list box from which the users can make a choice. The users cannot enter items that are not in the list.

The drop-down combo box

The simple combo box

The drop-down list

Combo Box features Use the AddItem, RemoveItem, and Clear methods to modify the contents of the list. Sorted or an unsorted list. Support the ItemData array and NewIndex property. No multiple choices Combo boxes Allows the users to enter choices that are not on the list. Drop-down list is useful for presenting several choices in a small amount of space.

Creating a Combo Box Draw a combo box on your form Select its style from the property window Add items to the List property at design or run time