Click vào nút Start Debugging để kiểm tra tài sản chỉ đọc lưới đầu tiên. Hai lưới xuất hiện với các dữ liệu từ bảng Giáo viên hướng dẫn và bảng lớp học của cơ sở dữ liệu . 4. Trong lưới đầu tiên, bấm vào các tế bào có chứa các số điện thoại cho Kim Halvorson, loại 1234567890, Hồ sơ này đang được cập nhật với một số mẫu điện thoại mới | Chapter 19 Data Presentation Using the DataGridView Control 485 You ll keep the default setting of False in this case you want to test updating the underlying database. Tip The complete DataGridView Sample program is located in the c vb08sbs chap19 datagridview sample folder. 3. Click the Start Debugging button to test the first grid s Readonly property. The two grids appear with data from the Instructors table and the Classes table of the database. 4. In the first grid click the cell containing the phone number for Kim Halvorson type 1234567890 and then press Enter. As you make the change a tiny pencil icon appears in the row header to the left indicating that a change is being made. Your screen looks similar to this - The Save Data button allows the user to write updates back to the original database if Readonly is set to False. This icon indicates an LThis record is being updated with edit is being made. a new sample phone number. When you press Enter or click a different cell in the grid the change is stored in the StudentsDataSet dataset. 5. Click the Save Data button on the navigation bar. Visual Studio uses the UpdateAll method in the grid s table adapter object to write the changed dataset to the underlying database. The program statement used to accomplish this save operation in the bindingNavigatorSaveItem_Click event procedure looks like this 486 Part IV Database and Web Programming TableAdapterManager is a new component in Visual Studio 2008 that makes it easier to control and manipulate more than one database table in a program. The UpdateAll method saves changes in all of the open tables in a program which means that it saves changes not only in the Instructors table but in the Classes table as well. You do not have to accept the default saving behavior here. If you would like to save only the changes in the Instructors table when your user clicks the Save Data button .