Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Grid for Microsoft .NET User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

9.3 DBBrowserGrid - Step 1

This section lists the steps required to create the first iteration of the DBBrowserGrid application. The first iteration of the application is a MDI Windows Forms application with a main form serving as a MDI main window and a child form containing Objective Grid for Microsoft .NET DBBrowserGrid control. In addition child form contains an array populated with simple objects, and has a menu commands which allow add/remove elements to the array and bind the array to the DBBrowserGrid control.

9.3.1 Create a New Solution and Project

  1. Open Microsoft Visual Studio.

  2. Create a new, blank solution, using the menu option File | New | Blank Solution.

    Figure 46: New Project Dialog

  3. In the solution explorer, right-click the DBBrowserGrid solution. A context menu appears. From the context menu, select Add | New Project.

  4. Select Form1. If the properties for Form1 are not already displayed, right-click the form; a context menu is displayed. Select Properties from the context menu.

  5. In the resulting property grid for the form, change the following properties:

  6. Select File | Save file as… from Visual Studio main menu and save the file as FrmMain.cs.

  7. Switch to the source code view of the FrmMain.cs file, and replace the code in the static void Main() function:

    with the following:

9.3.2 Add a Menu

  1. Switch back to design view, and drag a MainMenu component onto FrmMain.

  2. Add an item to the main menu with the title "&Bind to…"

  3. Add an item to the "Bind to.." submenu with the title "&Array".

  4. Now create an MDI child form: In the Solution Explorer, right-click Step 1, and in the popup menu select Add | Add Windows Form… .

  5. Select FrmArrays. If the properties for FrmArrays are not already displayed, right-click the form; a context menu is displayed. Select Properties from the context menu.

  6. In the resulting property grid for the form, change the following properties.

  7. Drag a MainMenu component onto FrmArrays.

  8. Add an item to the main menu with the title "&Array".

  9. Add items to the "Array" submenu with the following titles:

  10. Return to the FrmMain designer and double-click Bind to… | Arrays on the main menu. The code for

    appears. Enter the following code as the function body:

    This creates the instance of FrmArrays and adds it as an MDI child to the main application window.

9.3.3 Add the ItemClass Class

  1. Add a class with instances that will populate an array: In the Solution Explorer, right-click Step 1. In the popup menu, select Add | Add Class… .

  2. Switch back to the FrmArray and add a DBBrowserGrid control to FrmArray.

  3. Select and drag a DBBrowserGrid from the Toolbox onto the form.

  4. Select the DBBrowserGrid control. In the property grid for the control, change the following Grid Control properties:

  5. Add the following member to the FrmArrays class:

    and following initialization code to the FrmArray class constructor:

  6. Return to the FrmArrays designer, and double-click Array | Bind, Array | Add Item, and Array | Remove Item on the main menu. The code for

    appears. Enter the following code as the function body:

  7. Build and run the application. Create the MDI child window, click several times on the Array | Add Item item and on the Array | Bind item. You can see the properties values of the new object in the browser grid. You can edit them, un-bind and bind back, and see the changes actually stored in the objects. You cannot change read-only properties.

Figure 48: Completed DBBrowserGrid Step 1 in Action



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.