How to Bind to a CLR Object

The Common Language Runtime, or CLR, is an environment that allows Microsoft .Net languages to compile into an intermediary language and be run as programs. Binding data in the .Net framework means attaching a graphical user interface object, such as a drop-down box, to a piece of data that may be independent from the program. For example, a class written in a .Net language can be bound as a CLR object. The Visual Studio software makes this task quite fluid.

Things You'll Need

  • Visual Studio 2010
Show More

Instructions

    • 1

      Open Visual Studio 2010 by clicking on its program icon. When it loads, select “File/New/Project“ and click “Visual C#/Windows Forms Application.” A new Windows Form Application project is created, and a blank Windows Form appears in the main editor window.

    • 2

      Right-click on the panel labeled “Solution Explorer” on the left-hand side of the main editor window. A menu appears. Select “Add” and then “Class,” which opens a “New Class Wizard.” Click on “OK” to create the class with the default name “Class1.cs.”

    • 3

      Click the panel named “Toolbox” which is located on the right-hand side of the main editor window. This panel displays a list of GUI tools that can be placed on a Windows Form.

    • 4

      Click and drag the item labeled “ComboBox” onto the Windows Form. Release the mouse button to place the item.

    • 5

      Click the tiny black arrow in the upper-right corner of the “ComboBox.” A menu appears.

    • 6

      Check the box labeled “Use Data Bound Items.” Several fields appear, one of which is named “Data Source.”

    • 7

      Click on the “Data Source” box to open a menu. From here, any CLR objects that exist in a project are visible. Since this is a new project, there are no CLR objects to list.

    • 8

      Click “Add Project Source” to open a window labeled “Data Source Configuration Wizard.” The wizard allows you to add four different types of data as bound items: Databases, Services, Objects and Sharepoint objects.

    • 9

      Click “Objects” and press the “Next” button. The next page displays a project hierarchy, where “Class1.cs” will be displayed. Check the box next to it to bind it to the “ComboBox” item. You have now bound a CLR object to a GUI control.

Related Searches:

References

Comments

Related Ads

Featured