• Binding GridEX Control to a Data Source at Design Time [Janus GridEX WinForms Control v3.5 for .NET]

    Bind GridEX control to a DataSource available at design time.



    Follow these steps to create a simple form using a GridEX control to display records from a table in a database.



    1 - Create a new Visual Basic or C# project using "Windows Application" Template



    2 - Add a new Data Source to the application:



    Click in the "Add New Data Source..." menu under "Data" and follow the wizard to add "Products" table from JSNorthWind.mdb database.



    In the tutorial we used Provider = "Microsoft Access Database File (OLE DB)" and Database file name = "C:\JSNorthWind.mdb".



    3 - Build the project to be able to see JSNorthwindDataSet and ProductsTableAdapter as components in the Toolbox.



    4 - Drag from the tool box JSNorthwindDataSet component and ProductsTableAdapter component.



    Now that the connection has been set, we can start using GridEX control in the project.



    5 - Add GridEX Control to a tab in the Toolbox window by right clicking in the Toolbox window and click in "Choose Items..." menu. When the dialog appears, check "GridEX" control in the list and click OK.



    Note: If GridEX control doesn't appear as an option in the list, click the Browse button and open Janus.Windows.GridEX.v3.dll.



    6 - Drag a GridEX control from the toolbox into the Form designer.



    7 - Select GridEX control in the Form and set the following properties in the properties window:



    DataSource = JSNorthwindDataSet1

    DataMember = Products



    8 - Right click in the GridEX control and select "Retrieve Structure" menu. This action will force the control to read the data source structure and create the columns needed to show all the fields in the table.



    9 - Right click in the GridEX control and select "Designer" menu. In the Designer dialog, select Columns node under RootTable node and move the columns positions as you want using Move Up and Move Down toolbar buttons.



    10 - In the Load event of the Form fill the Products table in the dataset with the following code:



    In VB .Net



    ProductsTableAdapter1.Fill(JSNorthwindDataSet1.Products)



    In C#.Net



    productsTableAdapter1.Fill(jsNorthwindDataSet1.Products);







    11 - Press F5 and run the project.

    Source Of Information : Janus v3.5 Help Files for VS 2008