Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

480 Part IV Database and Web Programming



  1. Click OK to close the Edit Columns dialog box.


Now, you’ll set properties that control the appearance of all the columns in the table.

Note You use the Edit Columns dialog box to configure individual columns. To modify
properties that apply to all the columns in a table, you adjust property settings for the
data grid view object in the Properties window.


  1. In the Properties window, set the ColumnHeadersVisible property to False.


Although the column names are somewhat useful in this particular database,
sometimes column names don’t clearly identify their contents or they contain
abbreviations or words that you want to hide from your users. Setting this property
removes the column names from the table.


  1. Click the AlternatingRowsDefaultCellStyle property, and then click the ellipsis button.


The AlternatingRowsDefaultCellStyle property controls the color that appears in the
background of data grid view cells in alternating rows. Changing this setting produces
an alternating effect (white and the color you select) from row to row in the data grid
view. In my opinion, this effect makes it easy to read records in longer tables.
Visual Studio displays the CellStyle Builder dialog box, a tool used to set the properties
of column cells in data grid view tables.


  1. Click the BackColor property, click its arrow in the second column, click the Custom tab,
    and then click the light yellow color.
    Your dialog box looks like this. The yellow shading is not visible in this book, but you’ll
    see it in parts of the dialog box.

Free download pdf