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.

Slides:



Advertisements
Similar presentations
Lists, Loops, Validation, and More
Advertisements

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 5- 1 STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
Information System Design Lab 5&6. User Interface Design.
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
1 Lab6 Lab6 ComboBox Control Properties, Methods and Events.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Chapter 7 Lists, Loops, and Printing
Programming Based on Events
Lab4 ListBox Control Properties, Methods and Events.
VB Default Controls List Box, Combo Box
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.
List-based Controls. Slide 2 Introduction There are several controls that work with lists ComboBox ListBox CheckedListBox.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events.
Chapter 7: Sub and Function Procedures
This demo shows how to create a simple multiple choice exercise using drop down menu boxes with the forms tool within MSWord.
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 3 Tariq Aziz and Kevin Jones.
Compunet Corporation Programming with Visual Basic.NET GUI Chapter 3 Week 13 Tariq Aziz and Kevin Jones.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Programming with Microsoft Visual Basic th Edition CHAPTER SEVEN SUB AND FUNCTION PROCEDURES.
Programming with Microsoft Visual Basic 2012 Chapter 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.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
Chapter 7 Lists, Loops, and Printing Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
1 Graphical User Interfaces Part 2 Outline ListBoxes and CheckedListBoxes ListBoxes CheckedListBoxes ComboBoxes.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Seven More on the Repetition Structure.
Copyright © 2001 by Wiley. All rights reserved. Chapter 5: The Repetition Process in Visual Basic Event Driven Loops Determinate Loops Indeterminate Loops.
CIS 338: VB.NET Components Dr. Ralph D. Westfall April, 2011.
ListBox, ComboBox, Menu Chapter 5.4, ComboBox Control: Properties & Methods u Combines TextBox features with a short drop- down list  cboOne.AddItem(string)
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 – Graphical User Interfaces Part 2 Outline.
© 2012 EMC Publishing, LLC Slide 1 Chapter 7 The Math Class  Includes shared methods that perform common math functions.  Math Class methods include:
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 8: Chapter 5: Slide 1 Unit 8 List Boxes and the Do While Looping Structure.
Starting Out with Visual Basic.NET 2 nd Edition Chapter 5 Lists, Loops, Validation, and More.
7-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
Chapter 7 Lists, Loops, and Printing Programming In Visual Basic.NET.
Introduction to Problem Solving and Control Statements.
Select (drop-down list) Inputs. Insert/Form/List Menu.
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.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Lists, Loops, and Printing Chapter 7.
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.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
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.
List Boxes and Combo Boxes Provides a list of items to select from Various styles — choose based on Space available Need to select from an existing list.
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.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code (loop body) that may be executed several times. Fixed-count (definite) loops repeat.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 5 Decision Making.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 9: Chapter 5: Slide 1 Unit 9 Do Until and For… Next Loops Chapter 5 Lists,
ListBox and ComboBox Controls 7.5 – Book One on the computers.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Microsoft Visual Basic 2008: Reloaded Third Edition
Chapter 9 Programming Based on Events
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Repeating Program Instructions
Microsoft Visual Basic 2005: Reloaded Second Edition
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.
CIS16 Application Development and Programming using Visual Basic.net
Introduction to Problem Solving and Control Statements
Lecture Set 10 Windows Controls and Forms
Chapter 7 Lists, Loops, and Printing
Presentation transcript:

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 –User's ability to add to the list

110 M - 2 ListBox tool –1st prefix –Simple List Box with/without scroll bars ComboBox tool –cbo prefix –List may allow for user to add new items –List may "drop down" to display items in list Types of List Controls

110 M - 3 List Controls Visually List Boxes Dropdown Combo Box Simple Combo Box Dropdown List Combo Box Combo BoxesList Boxes

110 M - 4 Choosing List Type Many items, little space –Dropdown Combo Box –Dropdown List Combo Box Few items –List Box User allowed to add to the list –Simple Combo Box –Dropdown Combo Box

110 M - 5 Name and Text Properties ListBoxes –Name displayed at Design Time ComboBoxes –Text displayed and accessible at Design Time –Text also accessible at Run Time –If user enters new data in ComboBox then VB stores it temporarily in the Text property

110 M - 6 DropDownStyle Property Used to indicate the type of ComboBox –Dropdown Combo DropDown –Simple Combo Simple –Dropdown List DropDownList User cannot enter text at run time User can enter text at run time

110 M - 7 Items Collection List of items in a ListBox or ComboBox is a collection Collections are objects that have properties and methods that allow you to –Add items –Remove items –Refer to individual items –Count items –Clear the collection

110 M - 8 Index Property Zero based value used to reference individual items in the collection Position of an item in the list –1st item Index = 0 (1-1=0) –2nd itemIndex = 1 (2-1=1) –3rd item Index = 2 (3-1=2) So we can say that... –nth itemIndex = n-1

110 M - 9 SelectedIndex Property Use to identify currently selected item in the list If no item is selected SelectedIndex = -1 Use to select an item in the list

110 M - 10 Items.Count Property Use to determine number of items in the list Remember: Items.Count is the actual number of items in the list BUT the SelectedIndex property and Index will be 1 less. For example, it there are 20 items in the list: Items.Count=20BUT Index =19 for the last item in list

110 M - 11 lstSchools.Items(5) = "USC" ' Next line references the currently selected item strSelectedFlavor = lstFlavor.Items(lstFlavor.SelectedIndex) Using the Items Collection Use the index of the item to reference a specific item in the collection Remember that the index is zero based so the 1st item in the list is index position zero

110 M - 12 Filling a List At Design time in properties window 1. Go to Items property 2. Click on ellipses to open String Collection Editor 3. Separate items with ENTER key At Run time methods –Items.Add OR –Items.Insert

110 M - 13 Filling List - Design Time Click ellipses button to open

110 M - 14 Items.Add Method Use to add new items to the list at run time General Form Examples Object.Items.Add(ItemValue) lstNames.Items.Add("Brandon") lstDeptNums.Items.Add(100) cboMajors.Items.Add(txtMajors.Text) 'Next line adds new item user typed in to combo cboGrade.Items.Add(cboGrade.Text)

110 M - 15 Items.Insert Method Use to add new items to the list at run time at a specific location(index) in the collection General Form Examples lstDeptNums.Items.Insert(1, 100) cboGrade.Items.insert(0, "Freshman") cboMajors.Items.Insert(11, txtMajors.Text) Object.Items.Insert(IndexPosition, ItemValue)

110 M - 16 Items.RemoveAt Method Use to remove specific items from the list at run time by specifying the index of the item General Form Examples lstDeptNums.Items.RemoveAt(1) ' Next line removes the currently selected item cboGrade.Items.RemoveAt(cboGrade.SelectedIndex) Object.Items.RemoveAt(IndexPosition)

110 M - 17 Items.Remove Method Use to remove specific items from the list at run time by specifying the Text of the item General Form Examples lstDeptNums.Items.Remove("USC") ' Next line removes the currently selected item cboGrade.Items.Remove(cboGrade.Text) Object.Items.Remove(TextString)

110 M - 18 Clear Method Empty the entire list from list box or combo box, remove all the items General Form Examples lstDeptNums.Items.Clear( ) cboGrade.Items.Clear( ) Object.Items.Clear( )