of 11
8/14/2019 Lecture 13 Working With Structures (Array Lists)
1/11
Lecture 13 Working with Structures
using ArrayLists
8/14/2019 Lecture 13 Working With Structures (Array Lists)
2/11
Final Exam, PART I
Our Final Exam will be on this Tuesday Next Class, Nov 20. This final exam is mandatory (required):
If you do not attend, you will be assigned a grade ofF
Format: Paper Test Mixture of Multiple Choice, Free Answer, etc
The test is comprehensive (includes all course material) But I will focus on the material from Lectures 9-13:
L9 - VB .NET Input/Output L10 - Arrays L11 - Enumerations and Properties
L12 - Structures L13 Structures and ArrayLists
Notes: University Policy on Final Exams is STRICT You are required to bring your ID cards. You are required to be on time.
8/14/2019 Lecture 13 Working With Structures (Array Lists)
3/11
Final Exam, PART II
Add two new buttons to our in-class Customers
Project: A ClearButton Which allows users to clear the GUI textboxes (make them
empty). An Add Button
Which allows users to Add a new Customer to _customers By typing in the customer information and pressing Add
The customer should be added, and the GUI textboxes
cleared. When you come to the test, your work will be checked:
As you are taking the test.
Note 1: Do NOT open your project when you come to class ! Instead, run your executable, in your projects BIN folder.
If you open your Project, it will be regarded as CHEATING.
Note 2: This is entirely YOUR WORK: Use of other students work, etc is CHEATING (Automatic F)
Fred
Smith
18
Fred Smith([email protected])
8/14/2019 Lecture 13 Working With Structures (Array Lists)
4/11
Outline
Last lecture, we discussed Structures: Which allow us to combine several primitive Data Types (members)
And create a single, newly-defined Data Type In the context of a simple Customer Example.
Along the way, we also discussed adding Properties to Structures,
Allowing us to separate internally-visible and externally-visible attributes. And also to make composite properties.
In this Lecture, we continue our Customer example with ArrayLists A special Data Type provided by the VB .NET Framework
Which allows us to easily work with arrays of Structures.
8/14/2019 Lecture 13 Working With Structures (Array Lists)
5/11
Introduction: ArrayLists VB .NET provides a number ofCollections for developers:
= Pre-made Data Structures, provided in the .NETFrameworkClasses. System.Collections.*
These structures are conceptually similar to Arrays But are pre-designed to be convenient for specific purposes.
For instance, if wanted to construct a Client Database
Via an ordered list of Structures of type, Customer (last lecture). We could use a basic one-dimensional Array
However, we would have to RESIZE the array to add clients. Also, client deletion would require:
Moving the client to the end, Deletion and Re-sizing.
VB .NET provides theArray List: System.Collections.ArrayList Which allows convenient run-time manipulation.
We will examine this via Example By expanding our Customer Structure Example (last lecture).
8/14/2019 Lecture 13 Working With Structures (Array Lists)
6/11
Example: ArrayLists with Customer
8/14/2019 Lecture 13 Working With Structures (Array Lists)
7/11
Ex.(Cont.): Overriding ToString()
8/14/2019 Lecture 13 Working With Structures (Array Lists)
8/11
Ex (cont.): Deleting an Element
8/14/2019 Lecture 13 Working With Structures (Array Lists)
9/11
Ex (Cont.) : Deleting an Element
8/14/2019 Lecture 13 Working With Structures (Array Lists)
10/11
Ex. (cont): Check Function
8/14/2019 Lecture 13 Working With Structures (Array Lists)
11/11
Ex: Displaying SelectedCustomer