Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 5.19 KB

displaying-data-in-the-windows-forms-datagridview-control.md

File metadata and controls

77 lines (53 loc) · 5.19 KB
title description ms.date helpviewer_keywords ms.assetid
Displaying Data in DataGridView Control
Learn how to use the Windows Forms DataGridView control to display data from a variety of external data sources.
03/30/2017
data [Windows Forms], displaying in tabular format
data grids [Windows Forms], displaying data
displaying data [Windows Forms], data grids
DataGridView control [Windows Forms], displaying data
b170b52a-2ebd-4948-ac2f-e52d494cebb2

Displaying Data in the Windows Forms DataGridView Control

The DataGridView control is used to display data from a variety of external data sources. Alternatively, you can add rows and columns to the control and manually populate it with data.

When you bind the control to a data source, you can generate columns automatically based on the schema of the data source. If these columns do not appear just as you want them to, you can hide, remove, or rearrange them. You can also add unbound columns to display supplemental data that does not come from the data source.

Additionally, you can display your data using standard formats (such as currency format), or you can customize the display formatting to present your data however you need to (such as changing the background color for negative numbers, or replacing string values with corresponding images).

In This Section

Data Display Modes in the Windows Forms DataGridView Control
Describes the options for populating the control with data.

Data Formatting in the Windows Forms DataGridView Control
Describes the options for formatting cell display values.

Walkthrough: Creating an Unbound Windows Forms DataGridView Control
Describes how to manually populate the control with data.

How to: Bind Data to the Windows Forms DataGridView Control
Describes how to populate the control with data by binding it to a BindingSource that contains information pulled from a database.

How to: Autogenerate Columns in a Data-Bound Windows Forms DataGridView Control
Describes how to automatically generate columns based on a bound data source.

How to: Remove Autogenerated Columns from a Windows Forms DataGridView Control
Describes how to hide or delete columns generated automatically from a bound data source.

How to: Change the Order of Columns in the Windows Forms DataGridView Control
Describes how to rearrange columns generated automatically from a bound data source.

How to: Add an Unbound Column to a Data-Bound Windows Forms DataGridView Control
Describes how to supplement data from a bound data source by displaying additional, unbound columns.

How to: Bind Objects to Windows Forms DataGridView Controls
Describes how to bind the control to a collection of arbitrary objects so that each object is displayed in its own row.

How to: Access Objects Bound to Windows Forms DataGridView Rows
Describes how to retrieve an object bound to a particular row of the control.

Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls
Describes how to display data from two related database tables so that the values shown in one DataGridView control depend on the currently selected row in another control.

How to: Customize Data Formatting in the Windows Forms DataGridView Control
Describes how to handle the xref:System.Windows.Forms.DataGridView.CellFormatting?displayProperty=nameWithType event to change the appearance of cells depending on their values.

Reference

xref:System.Windows.Forms.DataGridView
Provides reference documentation for the xref:System.Windows.Forms.DataGridView control.

xref:System.Windows.Forms.DataGridView.DataSource%2A?displayProperty=nameWithType
Provides reference documentation for the xref:System.Windows.Forms.DataGridView.DataSource%2A property.

xref:System.Windows.Forms.BindingSource
Provides reference documentation for the xref:System.Windows.Forms.BindingSource component.

Related Sections

Data Entry in the Windows Forms DataGridView Control
Provides topics that describe how to change the way users add and modify data in the control.

See also