Click here to Skip to main content
15,353,757 members
Articles / Programming Languages / Visual Basic
Posted 18 Jul 2008


10 bookmarked

Create Data-entry Forms in Minutes Using ComponentOne InputPanel

18 Jul 2008CPOL5 min read
ComponentOne InputPanel for WinForms is a new paradigm to create and maintain data-entry forms. It is a panel that is placed on a form to help create powerful data input applications. Simply connect C1InputPanel to any data source and an input control for each field is automatically created for you.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Image 1


In the business world of deadlines, we need tools to help us get the job done efficiently and professionally. For those of you creating .NET data-entry forms, look no further. With ComponentOne InputPanel™ for WinForms, you can take this single control and create a complete data-entry form in minutes. It manages the design, layout, appearance, and behavior of multiple input components. Supported components include textboxes, numeric and masked input, combo boxes, rich labels, custom controls, and more. This tutorial demonstrates how to create a .NET data-entry form using ComponentOne InputPanel for WinForms.

About ComponentOne InputPanel

ComponentOne InputPanel for WinForms is part of ComponentOne Studio for WinForms, which is part of ComponentOne Studio Enterprise. InputPanel for WinForms is the new paradigm to create and maintain data-entry forms. It is a panel that can be placed on a Windows Form to help developers create powerful data input applications. Developers define what input fields they would like to expose using any combination of the nineteen built-in native data input controls provided or any .NET control. Or simply connect InputPanel for WinForms to a data source, select the record set, and an input control for each field is automatically created for you.


For this tutorial, you must have Microsoft Visual Studio 2008 or Visual Studio 2005 and ComponentOne Studio Enterprise installed.

Create a Data-entry Form Using ComponentOne InputPanel

With ComponentOne InputPanel, creating a complete .NET data-entry form is as simple as 1-2-3:

  1. Create a Windows Forms Application
  2. Add the C1InputPanel Control to Your Form
  3. Attach the C1InputPanel Control to a Data Source

1 – Create a Windows Forms Application

ComponentOne InputPanel is a WinForms based control. In order to use the C1InputPanel control, we must first create a Windows Forms Application.

Open Microsoft Visual Studio and select File| New Project from the menu.


For this tutorial, you can create either a C# or Visual Basic Windows Forms Application.

2 – Add the C1InputPanel Control to Your Form

Locate the C1InputPanel icon in the Visual Studio Toolbox and double-click it to add it to your application.


With C1InputPanel selected on your form, locate the Dock property in the Properties window and set it to “Fill”.


3 – Attach the C1InputPanel Control to a Data Source

Once you have C1InputPanel on the form and properly docked, it is time to connect to a data source. In this sample we will attach C1InputPanel to the “Employees” table in the Northwind database. To quickly link the C1InputPanel to the data source, click the smart tag to open the C1InputPanel Tasks menu.


From the “Choose Data Source” drop-down list, select “Add Project Data Source”. The Data Source Configuration Wizard opens. Choose Database for the data source type and click “Next”.


To choose your data connection, select the “New Connection” button and locate the Nwind.mdb database from the C:\Program Files\ComponentOne Studio.NET 2.0\Common directory. Click “Next” to continue through the wizard.

To choose your database objects, expand the Tables node and select the Employees node. Click “Finish” to complete the connection.

Notice that C1InputPanel automatically aligns the controls, adds proper label captions, and binds each individual editor to the data. C1InputPanel even adds a navigation control allowing you to quickly navigate the form at run time.


C1InputPanel Item Collection Editor

In just three steps you have created a fully functional data-entry form that can be used to view, modify, or add records to a database. But what if you want to customize the appearance of your data-entry form, such as: 1) rearrange the ordering of the items, 2) break the flow of the controls with a new column, 3) add new items to the form, and 4) spatially arrange the controls on the form? With the C1InputPanel Item Collection Editor, you can quickly locate the items’ settings and easily complete such tasks.

To begin, click the C1InputPanel smart tag and select “Edit Items” to open the Collection Editor.


1 - Re-arrange the Items’ Order on the Form

You can re-arrange controls on the form at any time without worrying about restructuring the entire form. C1InputPanel automatically reconfigures the tab order and realigns the controls.

The Collection Editor makes it easy to move single items or multiple items. From the Members list, select the “lblBirthDate” and ”dtpBirthDate” items and press the down arrow button to move the items just below the “imgPhoto” item.


2 – Break the Flow of the Controls with a New Column

By default, the items flow row-to-row on the form. You can break the flow of the controls by just setting one property. To do this, select the “dtpHireDate” item and set its Break property to “Column”.


The row will break after the “Hire Date” date picker and a new column will begin with the “Address” label and text box. All controls are automatically aligned.

3 – Add a New Item to the Form

So, now you want to add a new item to the form? No problem. Simply select an item from the item drop-down list. For this example, select “InputGroupHeader”, then click “Add”. Use the move up arrow to place the item just after “txtExtension”. Modify its Text property to “&Details”.


The controls are automatically re-aligned to make room for the new object.

4 – Spatially Arrange the Controls on the Form

If the controls appear too congested on the form and you want to space them out, you can simply increase the padding around the controls. For example, select the “lblAddress” and “txtAddress” items and set the padding’s Top property to “45”. All controls below the “Address” label and text box will shift accordingly while maintaining alignment on the form.


Click “OK” to close the Collection Editor. Run the application to observe the changes.


We have altered the layout of our application and added a new object in a short amount of time. Using C1InputPanel’s powerful editor, we didn’t have to write a single line of code.


ComponentOne InputPanel makes creating data-entry forms a breeze. This tutorial demonstrated how quickly you can create and modify a data-entry form without worrying about restructuring the entire form. InputPanel for WinForms' automatic alignment and tab order makes this possible. This easy setup, paired with low maintenance yields, increased productivity. Achieve polished, interactive .NET data-entry forms in minutes with ComponentOne InputPanel for WinForms.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided
Group type: Organisation

2 members

Comments and Discussions

QuestionProblem with Right to Left Pin
A7mad_3-Sep-12 2:12
MemberA7mad_3-Sep-12 2:12 
QuestionExcellent article Pin
omar sanchez10-Mar-10 8:58
Memberomar sanchez10-Mar-10 8:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.