ComponentOne List for WinForms
In This Topic
    Tutorial 1 - Binding C1List to a DataSet
    In This Topic

    In this tutorial, you will learn how to bind C1List to a DataSet and create a fully functional database browser. You will also learn about the basic properties of the C1List control. You will then be able to run the program and observe the run-time features of the list.

    1. Create a new .NET project.
    2. Double-click the C1List icon in Visual Studio's Toolbox to add it to the Form. 
      Note: See Adding ComponentOne Components to a Project for information on adding a component to the Toolbox.
    3. Go to the DataSource property and select Add Project Data Source from the drop-down. In the adapter's Data Source Configuration Wizard, either select a connection to C1NWind.mdb or create a new connection to this database. On the Choose your database objects page of the wizard, select all fields in the Composer table and type "DsComposer" into the DataSet name box, and then finish out the wizard.
      At this point, your .NET design window and form should look like the following:
    4. Visual Studio adds the following code to the Form_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Me.ComposerTableAdapter.Fill(Me.DsComposer.Composer)
      

      To write code in C#

      C#
      Copy Code
      this.ComposerTableAdapter.Fill(this.DsComposer.Composer);
      

    Run the program and observe the following:

    • C1List retrieves the database schema information from the DataSet and automatically configures itself to display all of the fields contained in the database table. Note that the field names are used as the default column headings.
    • C1List automatically communicates with the DataSet. Any actions taken on the DataSet will be reflected in the list.
    • You have created a fully functional database browser by only writing a one line of simple code.

    Refer to Run-Time Interaction and try the instructions for navigating, editing, and configuring the list at run time.

    To end the program, close the window or press the stop button on the .NET toolbar.

    This concludes the tutorial.