Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

33 Extra exercises for Murach's Visual Basic 201S Extra 17-1 Modify a list class to use an indexer, an event, and operators In this exercise,

image text in transcribed
33 Extra exercises for Murach's Visual Basic 201S Extra 17-1 Modify a list class to use an indexer, an event, and operators In this exercise, you'll modify a class that stores a list of inventory items so it uses an indexer, an event, and operators. Then, you'll modify the code for the Inventory Maintenance form so it uses these features. Open the project and review the code 1. Open the InventoryMaintenance project in the Extra Exercises Chapter I7UnventoryMaintenance directory. This is an enhanced version of the Inventory Maintenance application from extra exercise 11-1 that uses a list class. Review the code for the InvltemList class so you understand how it works. Then, review the code for the Inventory Maintenance form to see how it uses this class. Finally, run the application to see how it works. 2. Add an indexer to the InvItemList class 3. Delete the GetltemByIndex method from the InvltemList class, and replace it with an indexer that receives an integer value. This indexer should include both get and set procedures, and the get procedure should check that the value that's passed to it is a valid index. If the index isn't valid, the procedure should throw an ArgumentOutOfRangeException with a message that consists of the index value. 4. Modify the Invoice Maintenance form to use this indexer instead of the GetltemByIndex method. Then, test the application to be sure it still works Add overloaded operators to the InvltemList class 5. Add overloaded+and operators to the InvltemList class that add and remove an inventory item from the inventory item list. Modify the Inventory Maintenance form to use these operators instead of the Add and Remove methods. Then, test the application to be sure it still works. 6. Add an event to the InvltemList class Add an event named Changed to the InvltemList class that receives an InvltemList parameter. Then, add code to raise this event any time the inventory item list changes. 7. Modify the Inventory Maintenance form to use the Changed event to save the inventory items and refresh the list box any time the list changes. To do that, you'll need to add the WithEvents keyword to the declaration for the invltems variable, you'll need to code an event handler for the Changed event of the invltems object, and you'll need to remove any unnecessary code from the event handlers for the Save and Delete buttons. When you're done, test the application to be sure it still works. 8. 33 Extra exercises for Murach's Visual Basic 201S Extra 17-1 Modify a list class to use an indexer, an event, and operators In this exercise, you'll modify a class that stores a list of inventory items so it uses an indexer, an event, and operators. Then, you'll modify the code for the Inventory Maintenance form so it uses these features. Open the project and review the code 1. Open the InventoryMaintenance project in the Extra Exercises Chapter I7UnventoryMaintenance directory. This is an enhanced version of the Inventory Maintenance application from extra exercise 11-1 that uses a list class. Review the code for the InvltemList class so you understand how it works. Then, review the code for the Inventory Maintenance form to see how it uses this class. Finally, run the application to see how it works. 2. Add an indexer to the InvItemList class 3. Delete the GetltemByIndex method from the InvltemList class, and replace it with an indexer that receives an integer value. This indexer should include both get and set procedures, and the get procedure should check that the value that's passed to it is a valid index. If the index isn't valid, the procedure should throw an ArgumentOutOfRangeException with a message that consists of the index value. 4. Modify the Invoice Maintenance form to use this indexer instead of the GetltemByIndex method. Then, test the application to be sure it still works Add overloaded operators to the InvltemList class 5. Add overloaded+and operators to the InvltemList class that add and remove an inventory item from the inventory item list. Modify the Inventory Maintenance form to use these operators instead of the Add and Remove methods. Then, test the application to be sure it still works. 6. Add an event to the InvltemList class Add an event named Changed to the InvltemList class that receives an InvltemList parameter. Then, add code to raise this event any time the inventory item list changes. 7. Modify the Inventory Maintenance form to use the Changed event to save the inventory items and refresh the list box any time the list changes. To do that, you'll need to add the WithEvents keyword to the declaration for the invltems variable, you'll need to code an event handler for the Changed event of the invltems object, and you'll need to remove any unnecessary code from the event handlers for the Save and Delete buttons. When you're done, test the application to be sure it still works. 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions