COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.

Slides:



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

COMPUTER PROGRAMMING I Apply Procedures to Develop Menus,
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
C# Programming: From Problem Analysis to Program Design1 9 Programming Based on Events.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Programming Based on 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.
CVEV 118/698 Visual Basic Lecture 3 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
List-based Controls. Slide 2 Introduction There are several controls that work with lists ComboBox ListBox CheckedListBox.
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.
Chapter 8 Using Repetition with Loops and Lists. Class 8: Loops and Lists Write Do loops to execute statements repeatedly Write For loops to execute statements.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
Tutorial 7: Sub and Function Procedures1 Tutorial 7 Sub and Function Procedures.
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.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
COMPUTER PROGRAMMING I Objective 7.04 Apply Built-in String Functions (3%)
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Ch 11: Userforms CP212 Winter Topics Designing User Forms o Controls Setting Properties o Tab Order o Testing Writing Event Handlers o Userform_Initialize.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
1 Graphical User Interfaces Part 2 Outline ListBoxes and CheckedListBoxes ListBoxes CheckedListBoxes ComboBoxes.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
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.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Assignment #1 Advanced Computer Programming.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Seven More on the Repetition Structure.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
ListBox, ComboBox, Menu Chapter 5.4, ComboBox Control: Properties & Methods u Combines TextBox features with a short drop- down list  cboOne.AddItem(string)
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
3.2 VB.NET Events An Event Procedure Properties and Event Procedures of the Form Tab Order of Controls Exercises.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
7-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Controls Part 2. DateTimePicker Control Used for representing Date/Time information and take it as input from user. Date information is automatically.
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.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
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.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
IMS 3253: Forms, Controls, Properties, Events 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Program Elements Assignment.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code (loop body) that may be executed several times. Fixed-count (definite) loops repeat.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
21/03/ Working with Controls Text and List Boxes.
Use TryParse to Validate User Input
Microsoft Visual Basic 2008: Reloaded Third Edition
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Apply Procedures to Develop Message, Input, and Dialog Boxes
3.01 Apply Controls Associated With Visual Studio Form
Use TryParse to Validate User Input
3.01 Apply Controls Associated With Visual Studio Form
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
CIS 16 Application Development Programming with Visual Basic
Lecture Set 10 Windows Controls and Forms
Visual C# - GUI and controls - 1
Presentation transcript:

COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects

Objective/Essential Standard Essential Standard 6.00 Apply tools to obtain and validate user input. Indicator 6.01 Apply procedures to develop menus, List Box and Combo Box objects (3%)

ListBox & ComboBox

List boxes and combo boxes increase the interactivity of your application giving choices to the user. They allow the user to interface with your application. In this presentation we will look at how to add these new control objects to your application.

The ListBox Control The ListBox displays a list from which the user can select one or more items. If the list is longer than the list box, a scrollbar is automatically added.

The ListBox Control Properties (Name)  The name of a ListBox should start with the prefix lst (This is the lowercase letter L, not a number 1.) Items  Click in this property where it displays (Collection). A new dialog box called the String Collection Editor will appear. Type your list box items here.  Be careful with your spelling.  Make sure you hit the Enter key after the last item.

The ListBox Control Properties Text  The text property returns the actual string value of the item. The item selected when running is placed inside the text property. Enabled  The enabled property is set to true by default. If this property is set to false, the list box is not available for the user. Sorted  The sorted property is set to false by default. If this property is set to true, your collection of items will be sorted ascending. Visible  The visible property is set to true by default. If this property is set to false, the list box is not visible to the user.

Using The ListBox Control - Runtime SelectedIndex Property  This property allows the programmer to compare what the user has selected in the list box with a value.  The first item in the list box is at index position 0. If the user selects the first item in the list box, the SelectedIndex value will be 0, if the second item is selected, the SelectedIndex value is 1.  If no item is selected, the SelectedIndex value is -1.  This property is only available at runtime. ItemSelectedIndex Value First0 Second1 Third2

Using The ListBox Control - Runtime SelectedItem Property  This property allows the programmer to compare what the user has selected in the list box with the item itself as a string value.  The comparison is exact, so your spelling, capitalization, and spacing matters.  This property is only available at runtime. ItemSelectedItem Value FirstChocolate SecondStrawberry ThirdVanilla

Using The ListBox Control ListBox. SelectedIndexChanged & SelectedIndex  You will use a SelectedIndexChanged event to compare either index values or the item to determine the list box item selected. 3

Runtime Commands - ListBox Control During runtime, you can add, delete and clear all items from a ListBox using Items.Add, Items.Remove and Items.Clear. Me.lstFlavors.Items.Add(“Cherry”) ‘Adds Cherry to the lstFlavors collection Me.lstFlavors.Items.Remove(“Vanilla”) ‘Removes Vanilla from the lstFlavors collection Me.lstFlavors.Items.Clear() ‘Clears the entire list.

ListBox & ComboBox SelectedIndexChanged Just like you create a TextChanged event for a TextBox, you can create a SelectedIndexChanged event for a ListBox or ComboBox. You can use this event to clear the answer from a label. Private Sub lstChoice_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstChoice.SelectedIndexChanged Me.lblResult.Text = Nothing’Clears Label End Sub

The ComboBox Control The ComboBox displays a list in a drop-down box. It is actually a combination of a textbox and a listbox. The top of the ComboBox allows the user to type input. The second part of the ComboBox displays a list of items from which the user can select. Textbox Listbox

The ComboBox Control Properties (Name)  The name of a ComboBox should start with the prefix cbo Items  Click in this property where it displays (Collection). A new dialog box called the String Collection Editor will appear. Type your items here.  Be careful with your spelling.  Make sure you hit the Enter key after the last item.

The ComboBox Control Properties Text  The text property returns the actual string value of the item. Enabled  The enabled property is set to true by default. If this property is set to false, the list box is not available for the user. Sorted  The sorted property is set to false by default. If this property is set to true, your collection of items will be sorted ascending. Visible  The visible property is set to true by default. If this property is set to false, the list box is not visible to the user.

Using ComboBox Control –Visual Studios 2010 Whether a value was keyed or an item selected, the text property will hold the value. Example: MessageBox.Show(Me.cboComboBox.Text) ’value typed or item selected is shown.

Try It! Create a new application called iceCreamExample  Save it into the location as instructed by your teacher. Add the following controls. When the button Order is clicked, the order should be displayed in the lblOrder label. ControlNameText/Items LabellblFlavorsFlavors ListBoxlstFlavorsChocolate Strawberry Vanilla LabellblConeCone/Cup ComboBoxcboComeCup Sugar Cone Waffle Cone LabellblOrderEmpty

When to use a ComboBox vs. a ListBox Use a ComboBox when there is a list of suggested choices. A ListBox gives the user a list of choices whereas a ComboBox allows the user to enter input (the TextBox portion) in addition to providing options.

Conclusion This PowerPoint provided an overview of adding a menu in Visual Studio. For more information   us/library/2chz8edb(v=VS.80).aspx us/library/2chz8edb(v=VS.80).aspx