478 Part IV Database and Web Programming
The program statement in the Form1_Load event procedure that populated the data
grid view with information from the Faculty table looks like this:
Me.FacultyTableAdapter.Fill(Me.Faculty2010DataSet.Faculty)
This line was added to your program by Visual Studio when you dragged the Faculty
table to the form from the Data Sources window.
Each row in the data grid view represents a record of data from the Faculty table in the
database. Scroll bars are provided so that you can view any records or columns that
aren’t immediately visible. This is a handy ease-of-use feature that comes automatically
with the DataGridView control.
- Scroll down the list of records to view all 20 rows, which represent faculty employee
data for a university. - Reduce the size of the First Name column by placing the pointer between the First
Name and E-mail Address column headings and dragging the column border to the left.
When you place the pointer between the column headings, it changes to a resizing
handle. You can resize columns at run time because the data grid view object’s
AllowUserToResizeColumns property is by default set to True. If you want to prevent
resizing, you can set this property to False. - Widen the E-mail Address column to see more of the e-mail name for each faculty
member.
When a data grid view object is filled with data, you can also take advantage of the
DataGridView control’s sorting feature. - Click the Last Name column heading.
The data grid view is sorted alphabetically by the last names of the faculty members.
Your form looks something like the following screen shot: