486 Part IV Database and Web Programming
Enable updates to the database
- Click the first data grid view object on the form (FacultyDataGridView).
- In the Properties window, scroll to the ReadOnly property, and then examine its
property setting.
If the ReadOnly property is set to False, the user is free to make changes to the
information in the data grid view cells. If you want to allow your users to modify the
information and write it back to the database your program is connected to, you
should keep this default setting. If you want to disable editing, you should set the
ReadOnly property to True.
You’ll keep the default setting of False in this case—you want to test updating the
underlying Faculty2010 .accdb database.
Tip The complete DataGridView Sample program is located in the C:\Vb10sbs\Chap19\
Datagridview sample folder.
- Click the Start Debugging button to test the first grid’s ReadOnly property.
The two data grid view objects appear with data from the Faculty table.
- In the first data grid view object, in the record for Physics faculty member Wilson Pais,
click the cell containing Lecturer (the Faculty Type field), type Assistant Professor,
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: