MobileForms Toolkit Documentation

SmartGrid.LoadData Method 

Loads the data with the data connector.

public void LoadData(
bool bCreateColumns
);

Parameters

bCreateColumns
If set to true creates set of default columns to display data.

Return Value

The Mapping of the loaded data rows.

Remarks

Removes all existing rows from the SmartGrid.

Example

[Visual Basic]

Dim myCommand As New System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM customers")
Dim myConnection As New System.Data.SqlServerCe.SqlCeConnection(_
    "DataSource = \\My Documents\\Northwind.sdf")

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)    Handles MyBase.Load
    Try
        ' set up the command for the DbConnector (not required, if set in designer)
        myCommand.Connection = myConnection
        SmartGrid1.DbConnector.Command = myCommand

        ' load the data
        SmartGrid1.LoadData(False)

    Catch ex As System.Data.SqlServerCe.SqlCeException
        MessageBox.Show(ex.Message)
    End Try
End Sub
            
[C#]

SqlCeCommand myCommand = new SqlCeCommand("SELECT * FROM customers");
SqlCeConnection myConnection = new SqlCeConnection("DataSource = \\My Documents\\Northwind.sdf");
    
private void Form1_Load(object sender, System.EventArgs e)
{
    try
    {
        // set up the command for the DbConnector (not required, if set in designer)
        myCommand.Connection = myConnection;
        smartGrid1.DbConnector.Command = myCommand;

        // load the data
        smartGrid1.LoadData(false);
    }
    catch(SqlCeException ex)
    {
        MessageBox.Show(ex.Message);
    }
}        
            

See Also

SmartGrid Class | Resco.Controls.SmartGrid Namespace