Changes

Jump to: navigation, search

Visual Basic and the DataGridView Control

1,263 bytes added, 19:18, 9 August 2007
no edit summary
==
 
== Adding a DataGridView Control ==
[[Image:Example.jpg]]
Now that we have our data sources configured the next step is to add a DataGridView control to our application. Access the ''Toolbox'' and drag and drop the ''DataGridView'' control onto the form. Resize the control so that fills the entire form and set the ''Anchor'' property in the ''Properties'' panel so that all sides are anchored (such that when teh form is resized the DataGridView will also resize).
 
If the ''Data Sources'' panel is not visible, select the ''Data->Show Data Sources'' menu option. Once visible, click and drag the ''Customers'' table from the ''Data Sources'' panel over the DataGridView control on the form. The form will update to display a columns, and rows. Press'''F5'' to build and run the application:
 
[[Image:Exampl.jpg]]
 
== Customizing the DataGridView Control ==
 
Various aspects of the DataGridView control can be configured using Visual Studio, such as the columns displayed.
 
To edit the columns displayed in the grid, right click with the mouse over the control in the form designer and select ''Edit Columns...''. The following dialog will appear. Use the ''Add...'' and ''Remove'' buttons to configure the columns displayed by the grid:
 
[[Image:Exampl.jpg]]

Navigation menu