In this section the changes made to Course objects bound are
saved to the DataGridView control to the database and also run the
completed Course Manager application.
Save changes made to
, drag the
control to the
form designer, change the
of the control to
, and change the
form designer, double-click the
control. This creates the
event handler method.
Paste the following code that saves object changes to the
' Save object changes to the database, display a message,
' and refresh the form.
MessageBox.Show("Changes saved to the database.")
Catch ex As Exception
// Save object changes to the database, display a message,
// and refresh the form.
MessageBox.Show("Changes saved to the database.");
catch (Exception ex)
event handler method, type the following code. This code
disposes of the object context before the form is closed.
' Dispose the object context.
// Dispose the object context.
Build and run the Class Scheduling
, to build and run the application.
When the form loads, select a department from the
control to display the courses that belong to that