và bạn có thể sử dụng các điều khiển tương tự như để hiển thị dữ liệu. Trong ứng dụng ppq, người dùng không cần phải cập nhật dữ liệu, nhưng các quản trị viên trang web có thể để cập nhật các trình đơn và giá cả. Trong chương này, | Placing an Order If MenuItemID AndAlso ItemSize Then Return index End If index 1 Next Return -1 End Function 13. Save the file. You re not going to be able to use this yet because we need to create more code and pages but let s see how the code works. How It Works The first thing we did was to add an Imports statement Imports This tells the compiler where to find some of the classes our new class will use. We ll explain what those are later but all of the classes are divided into namespaces which is a way to logically separate the classes making them easy to find. For example all of the classes relating to SQL Server are in the .SqlClient namespace. Learning about namespaces and the classes within them is useful when you start to use code because there are a large number of supplied classes that can make your life as a programmer much easier. At the start of the chapter we mentioned that classes are templates that provide properties methods and events and that s exactly what this code does. It defines a class with properties and methods there are no events in this one because they aren t needed. You define a class with the Class statement Public Class CartItem End Class The Public Class and End Class keywords define the start and end of the class while CartItem is the name given to the class. This class will store a single item within the shopping cart. Within the class we defined some variables Private _menuItemID As Integer Private _itemName As String Private _itemSize As String Private _quantity As Integer Private _itemPrice As Decimal These are used to hold the values of a cart item. Following are the parts of these variable declarations Private which means that the variable cannot be seen outside of the class and we ll explain why this is a good thing when we look at the declaration of the properties. Variable name for example _menuItemID . As Data Type for example As Integer . 203 Chapter 7