Partager via


Using the DataGrid in the .NET Compact Framework 

The DataGrid class in the .NET Compact Framework provides the core functionality of the Windows Forms DataGrid class in the full .NET Framework. The .NET Compact Framework does not support the following DataGrid-related types:

NoteNote

The DataGrid class for the .NET Compact Framework is in a separate assembly. You must add a reference to System.Windows.Forms.DataGrid.dll in your project to use it.

In the .NET Compact Framework version 2.0, you can set the DataSource property to a DataSet. For better performance, bind to a particular DataTable in the DataSet.

Note that the SetDataBinding method is not supported, but you can use a BindingSource component to encapsulate all data sources on your form including the DataGrid. The BindingSource provides access to the underlying data.

In the .NET Compact Framework, you cannot directly edit the contents of the DataGrid at run time. You must bind controls, such as a TextBox, to your data source and use the DataGrid to display and select records. For examples, see How to: Use the DataGrid on the Pocket PC and How to: Use the DataGrid on the Smartphone.

See Also

Tasks

How to: Use the DataGrid on the Pocket PC
How to: Use the DataGrid on the Smartphone

Other Resources

Data Access and XML Support