ComponentOne True DBGrid for WinForms
True DBGrid for WinForms Task-Based Help / Saving the Layout of the Grid
In This Topic
    Saving the Layout of the Grid
    In This Topic

    To save the layout of the grid, use the SaveLayout method, which will save the layout in an XML file. This can be done either in the designer or in code.

    In the Designer

    Complete the following steps to save the layout of the grid:

    1. Open the C1TrueDBGrid Designer. For information on how to access the C1TrueDBGrid Designer, see Accessing the C1TrueDBGrid Designer.
    2. In the designer, click Save Layout on the toolbar to open the Save As dialog box.
    3. Browse to a location and enter a file name in the File Name box.
    4. Click Save to save the layout as an XML file.
    5. Click OK to close the designer.

    In Code

    Add the following code to the Click event of a button to save the layout of the grid:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.SaveLayout("c:\temp\ComposerLayout.xml")
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.SaveLayout(@"c:\temp\ComposerLayout.xml");
    

    What You've Accomplished

    You've learned how to use the SaveLayout method to save the layout in an XML file.