InputPanel for WinForms | ComponentOne
In This Topic
    In This Topic

    Data binding lets you populate the control with data by fetching it from an underlying data source. InputPanel supports data binding at design-time as well as at run-time. The control supports data binding to most of the commonly used data sources such as ObservableCollection, IList, List, Array, BindingSource, ADO.NET objects such as DataSet, DataTable etc. On binding InputPanel to a data source object at design time, the control is automatically populated with components used to view and edit the data in the data source, including keyboard accelerators.

    Binding at Design Time

    1. In the design view, select the C1InputPanel control and click smart tag to open the C1InputPanel Tasks menu.
    2. Click the Choose Data Source drop down button and select Add Project Data Source... option to open the Data Source Configuration Wizard.
    3. On Choose a Data Source Type page, select Database and click Next.
    4. On Choose a Database Model page, select Dataset and click Next.
    5. On Choose Your Data Connection page, click New Connection to open the Add Connection dialog.
    6. Against the DataSource field, click Change... button to open the Change Data Source dialog.
    7. Select Microsoft Access Database File and click OK to return to the Add Connection dialog.
    8. Against the Database file name field, click Browse and navigate to the database file. Provide the User name and Password, if required to connect to the database file. This example uses C1NWind.mdb file located at the following location by default:
      \Documents\ComponentOne Samples\Common
    9. Click Test Connection to make sure that you have successfully connected to the database or server and click OK.
    10. Click OK again to close the Add Connection dialog box.
    11. Click Next to continue. A dialog box will appear asking if you would like to add the data file to your project and modify the connection string. Choose the appropriate option as per your requirement.
    12. Save the connection string in the application configuration file by checking the Yes, save the connection as box and entering a name.
    13. Click Next to switch to the Choose Your Database Objects page.
    14. Choose a table, say Employees from the Tables node and click Finish.
    15. The above steps add a dataset and connection string to your project. Also, Visual Studio automatically creates the following code to fill the dataset:
      // This line of code loads data into the 'c1NWindDataSet.Employees' table. You can move, or remove it, as needed.
      ' This line of code loads data into the 'c1NWindDataSet.Employees' table. You can move, or remove it, as needed.
    See Also