Udostępnij za pośrednictwem


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. This control is read-only in the .NET Compact Framework, and it does not support the following DataGrid-related types:

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 in the .NET Compact Framework