Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

17.13 DataGrid Control

DataGrid Control

Similar to printing a manually populated dataset is printing the contents of a DataGrid control. You can have a datagrid on a form and give the user the option to send the datagrid contents to a report. The user modifies the datagrid and sends its values to a report without having to save it first.

Fortunately, this is very easy because the datagrid is designed to work with datasets. The datagrid has a DataSource property that can be explicitly cast as a DataSet object. In Listing 17-7, the MyDataSet parameter is set to the DataSource property.

Listing 17-7. Getting the DataSet object from a DataGrid control.
Private Sub FillDataset(ByVal MyDataSet As DataSet)
MyDataSet = CType(DataGrid1.DataSource, DataSet)
End Sub