FlexGrid for WinForms | ComponentOne
C1.Win.C1FlexGrid Namespace / Extensions Class / LoadGrid Method / LoadGrid(C1FlexGridBase,String,FileFormatEnum,FileFlags,Encoding) Method
The C1FlexGridBase instance to which a file will be loaded.
Name of the file to load, including the path.
File format to use.
Options to use when loading the file.
The System.Text.Encoding to use when loading the file.

In This Topic
    LoadGrid(C1FlexGridBase,String,FileFormatEnum,FileFlags,Encoding) Method
    In This Topic
    Loads the grid from a file.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub LoadGrid( _
       ByVal grid As C1FlexGridBase, _
       ByVal fileName As String, _
       ByVal format As FileFormatEnum, _
       ByVal flags As FileFlags, _
       ByVal encoding As Encoding _
    ) 

    Parameters

    grid
    The C1FlexGridBase instance to which a file will be loaded.
    fileName
    Name of the file to load, including the path.
    format
    File format to use.
    flags
    Options to use when loading the file.
    encoding
    The System.Text.Encoding to use when loading the file.
    Remarks

    This method loads grid from a file previously saved with the SaveGrid(C1FlexGridBase,String,FileFormatEnum,FileFlags,Encoding) method. Formats supported include comma-delimited text files (CSV format), tab-delimited text files, and Microsoft Excel files (.XLS).

    When loading text files, rows and columns are added to the grid if needed to accommodate the file contents. Text files contain only data and no formatting information.

    When loading Excel files, the grid retrieves the first worksheet from the specified workbook file. The LoadExcel(C1FlexGridBase,String,String,FileFlags) method allows you to specify which worksheet should be loaded. You can use the LoadExcelSheetNames(C1FlexGridBase,String) method allows you to retrieve a list of the worksheets stored in an XLS file. The grid can save and load data and formatting information from XLS files.

    Grids can also be persisted to Xml format using the WriteXml(String,XmlOptions) and C1FlexGridBase.ReadXml methods.

    See Also