.Net Control Suite for Delphi

Reusable .Net components that encapsulate user interface (UI) functionality and are used in client side Windows applications. Allows developers to create professional applications that incorporate a full set of .Net User Interface (UI) controls. Contains top-performing .Net UI controls in Delphi for every aspect of Delphi desktop development.

Buy Download
.Net VCL 4 Delphi




CheckBox

The CheckBox control (TCnCheckBox) is a .Net control in Delphi that supports several appearance customization options such as backcolors, flat appearance settings and various alignment options for the text, image and checkbox. It also provides options to display images and background image.

The CheckBox control can display an image or text or both. Images can be set using either the ImageList or Image properties. The CheckBox control's ThreeState property can be used to direct the control to return the Checked, Unchecked, and Indeterminate values. You need to set the checkbox's ThreeState property to True to indicate that you want it to support three states.

The following code snippet creates a CheckBox control object.

procedure TForm8.FormCreate(Sender: TObject);
var
    dynamicCheckBox: TCnCheckBox;
begin
    dynamicCheckBox := TCnCheckBox.Create(Self);
    dynamicCheckBox.Left := 20;
    dynamicCheckBox.Top := 20;
    dynamicCheckBox.Width := 300;
    dynamicCheckBox.Height := 30;

    // Set background and foreground
    dynamicCheckBox.BackColor.Name := 'Orange';
    dynamicCheckBox.ForeColor.Name := 'Black';
    dynamicCheckBox.Text := 'I am a Dynamic CheckBox';
    dynamicCheckBox.Name := 'DynamicCheckBox';
    dynamicCheckBox.Font.Name := 'Georgia';
    dynamicCheckBox.Font.Size := 12;

    dynamicCheckBox.Parent := Self;
end;

ClrContainer

A ClrContainer control (TClrContainer) provides a simple way to host .Net controls in Delphi VCL Forms. The ClrContainer Control is a container control which can host a group of .net controls. It can be used for grouping collections of .Net controls.

The image below is the ClrContainer on Delphi VCL form at design time.

The image below demonstrates how the ClrContainer has been used to host .Net DatagridView control in Delphi at runtime.

The source codes for using the ClrContainer control, can be downloaded from the download page or in the demo folder of the .Net VCL for Delphi installation.

DomainUpDown

A DomainUpDown control (TCnDomainUpDown) is a .Net control in Delphi which allows users to provide a spin (up/down) interface to move through pre-defined strings using up and down arrows.

The DomainUpDown control is similar to the NumericUpDown control, the difference is that the TCnDomainUpDown can display a list of strings, whereas the TCnNumericUpDown can display only a list of integers. The DomainUpDown control displays a list of options in a very space-efficient way because it can display only one option at a time to the user.

The control appears as a textbox with a pair of up and down arrows on the right side of the control. Clicking the up arrow moves you up the list of options; the down arrow moves you down the list. If the ReadOnly property is set to false, the user can type the name of the item in the list.

If ReadOnly is false, the user can enter text into the control that does not match an item in the list. The Text property will return the current text in the control. This means that you may need to do some input validation if ReadOnly is set to false. Because no input validation is performed by the DomainUpDown control, entering text into the control will not select a matching item. Setting ReadOnly to true restricts the user to selecting only items in the list, thus eliminating the need for input validation.

The DomainUpDown control exposes the Items property that represents the list of items in the control. You can add items to the list by using the Add method exposed on the Items property. The following code demonstrates how to add three items to a DomainUpDown control:

procedure TForm8.FormCreate(Sender: TObject);
var
  dynamicDomainUpDown: TCnDomainUpDown;
begin
  dynamicDomainUpDown := TCnDomainUpDown.Create(Self);
  dynamicDomainUpDown.Left := 20;
  dynamicDomainUpDown.Top := 20;
  dynamicDomainUpDown.Width := 100;

  //Add items to DomainUpDown
  dynamicDomainUpDown.Items.Add('TX');
  dynamicDomainUpDown.Items.Add('LA');
  dynamicDomainUpDown.Items.Add('WA');

  // Set background and foreground
  dynamicDomainUpDown.BackColor.Name := 'Orange';
  dynamicDomainUpDown.ForeColor.Name := 'Black';

  dynamicDomainUpDown.Font.Name := 'Georgia';
  dynamicDomainUpDown.Font.Size := 12;

  dynamicDomainUpDown.Text := 'TX';
  dynamicDomainUpDown.Name := 'dynamicDomainUpDown';

  dynamicDomainUpDown.Parent := Self;
end;

MaskedTextBox

A MaskedTextBox control (TCnMaskedTextBox) is a .Net control in Delphi which provides a validation mechanism for user input on a Form. For example, if you want a TextBox to accept a date in mm/dd/yyyy format, you can set masking in the TCnMaskedTextBox. MaskedTextBox accepts text input of a specific format. We often require phone numbers to have their area code and also the correct number of digits. To solve this problem, we use the MaskedTextBox control in VCL Forms.

When you need versatile data entry controls combined with strict validation, the MaskedEditBox control for VCL Forms is the perfect match to your criteria. It is an intelligent component for controlled data input, which enhances the functionality of the regular textbox by adding input validation and masks, such as date, IP Address, SSN, phone number, digits, decimals, and more.

The MaskedTextBox control is an enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input. Using the Mask property, you can specify the following input without writing any custom validation logic in your application:
  • Required input characters.
  • Optional input characters.
  • The type of input expected at a given position in the mask; for example, a digit, or an alphabetic or alphanumeric character.
  • Mask literals, or characters that should appear directly in the MaskedTextBox; for example, the hyphens (-) in a phone number, or the currency symbol in a price.
  • Special processing for input characters; for example, to convert alphabetic characters to uppercase.

When a MaskedTextBox control is displayed at run time, it represents the mask as a series of prompt characters and optional literal characters. Each editable mask position, representing a required or optional input, is shown with a single prompt character. For example, the number sign (#) is often used as a placeholder for a numeric character input. You can use the PromptChar property to specify a custom prompt character. The HidePromptOnLeave property determines if the user sees the prompt characters when the control loses input focus.

As the user types input into the masked text box, valid input characters replace their respective prompt characters in a sequential fashion. If the user types an invalid input character, no replacement occurs, but instead a beep is issued if the BeepOnError property is set to true, and the OnMaskInputRejected event is raised. You can provide your own custom error logic by handing this event.

Mask must be a string composed of one or more of the masking elements, as shown in the following table. The masking language used by TCnMaskedTextBox is defined by its associated MaskedTextProvider.

Masking element Description
0 Digit, required. This element will accept any single digit between 0 and 9.
9 Digit or space, optional.
# Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the Text property. Plus (+) and minus (-) signs are allowed.
L Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions.
? Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions.
& Character, required. If the AsciiOnly property is set to true, this element behaves like the "L" element.
C Character, optional. Any non-control character. If the AsciiOnly property is set to true, this element behaves like the "?" element.
A Alphanumeric, required. If the AsciiOnly property is set to true, the only characters it will accept are the ASCII letters a-z and A-Z. This mask element behaves like the "a" element.
a Alphanumeric, optional. If the AsciiOnly property is set to true, the only characters it will accept are the ASCII letters a-z and A-Z. This mask element behaves like the "A" element.
. Decimal placeholder. The actual display character used will be the decimal symbol appropriate to the format provider, as determined by the control's FormatProvider property.
, Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the format provider, as determined by the control's FormatProvider property.
: Time separator. The actual display character used will be the time symbol appropriate to the format provider, as determined by the control's FormatProvider property.
/ Date separator. The actual display character used will be the date symbol appropriate to the format provider, as determined by the control's FormatProvider property.
$ Currency symbol. The actual character displayed will be the currency symbol appropriate to the format provider, as determined by the control's FormatProvider property.
< Shift down. Converts all characters that follow to lowercase.
> Shift up. Converts all characters that follow to uppercase.
| Disable a previous shift up or shift down.
\ Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.
All other characters Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.

If you change a mask when TCnMaskedTextBox already contains user input filtered by a previous mask, TCnMaskedTextBox will attempt to migrate that input into the new mask definition. If it fails, it will clear the existing input. Assigning a zero-length string as the mask will preserve any existing data in the control. When used with a zero-length mask, TCnMaskedTextBox behaves like a single-line TextBox control.

The decimal (.), thousandths (,), time (:), date (/), and currency ($) symbols default to displaying those symbols as defined by the application's culture. You can force them to display symbols for another culture by using the FormatProvider property.

Character insertion into the mask at run time is controlled by the InsertKeyMode property. Users can navigate through the mask by using the left and right arrow keys or the mouse cursor, and can skip optional positions in the mask by entering a space.

The following table shows example masks.
Mask Behavior
00/00/0000 A date (day, numeric month, year) in international date format. The "/" character is a logical date separator, and will appear to the user as the date separator appropriate to the application's current culture.
00->L<LL-0000 A date (day, month abbreviation, and year) in United States format in which the three-letter month abbreviation is displayed with an initial uppercase letter followed by two lowercase letters.
(999)-000-0000 United States phone number, area code optional. If users do not want to enter the optional characters, they can either enter spaces or place the mouse pointer directly at the position in the mask represented by the first 0.
$999,999.00 A currency value in the range of 0 to 999999. The currency, thousandth, and decimal characters will be replaced at run time with their culture-specific equivalents.

NumericUpDown

A NumericUpDown control (TCnNumericUpDown) is a .Net control in Delphi which allows users to increase or decrease the numeric values using spin button interface with various customization options.

A NumericUpDown control contains a single numeric value that can be incremented or decremented by clicking the up or down buttons of the control. The user can also enter in a value, unless the ReadOnly property is set to true. The numeric display can be formatted by setting the DecimalPlaces, Hexadecimal, or ThousandsSeparator properties. To display hexadecimal values in the control, set the Hexadecimal property to true. To display a thousands separator in decimal numbers when appropriate, set the ThousandsSeparator property to true. To specify the number of digits displayed after the decimal symbol, set the DecimalPlaces property to the number of decimal places to display.

To specify the allowable range of values for the control, set the Minimum and Maximum properties. Set the Increment value to specify the value to be incremented or decremented to the Value property when the user clicks the up or down arrow buttons. You can increase the speed that the control moves through numbers when the user continuously presses the up or down arrow by setting the Accelerations property.

When the UpButton or DownButton methods are called, either in code or by the click of the up or down buttons, the new value is validated and the control is updated with the new value in the appropriate format. Specifically, if the UserEdit property is set to true, the ParseEditText method is called prior to validating or updating the value. The value is then verified to be between the Minimum and Maximum values, and the UpdateEditText method is called.

PictureBox

A PictureBox control (TCnPictureBox) is a .Net control in Delphi used to display images in Windows Forms. PictureBox provides a rectangular region for an image. It supports many image formats. It has an adjustable size. It can access image files from your disk or from the Internet. It can resize images in several different ways.

The TCnPictureBox control is used to display images in bitmap, GIF , icon , or JPEG formats. You can set the Image property to the Image you want to display, either at design time or at run time. You can programmatically change the image displayed in a picture box, which is particularly useful when you use a single form to display different pieces of information. The SizeMode property, which is set to values in the TPictureBoxSizeMode enumeration, controls the clipping and positioning of the image in the display area.

The TCnPictureBox is not a selectable control, which means that it cannot receive input focus.

RadioButton

A RadioButton control (TCnRadioButton) is a .Net control in Delphi which enables the user to select a single option from a group of choices when paired with other TCnRadioButton controls. Radio buttons are usually placed in a group on a container control, such as a Panel or a GroupBox, and one of them is selected.

The RadioButton control can display text, an Image, or both.

When the user selects one option button (also known as a radio button) within a group, the others clear automatically. All RadioButton controls in a given container, such as a Form, constitute a group. To create multiple groups on one form, place each group in its own container, such as a GroupBox or Panel control.

TCnRadioButton and TCnCheckBox controls have a similar function: they offer choices a user can select or clear. The difference is that multiple CheckBox controls can be selected at the same time, but option buttons are mutually exclusive.

Use the Checked property to get or set the state of a TCnRadioButton. The option button's appearance can be altered to appear as a toggle-style button or as a standard option button by setting the Appearance property.

RichTextBox

A RichTextBox control (TCnRichTextBox) is a .Net control in Delphi with an advanced text box that provides text editing and advanced formatting features including loading rich text format (RTF) files.

With the RichTextBox control, the user can enter and edit text. The control also provides more advanced formatting features than the standard TextBox control. Text can be assigned directly to the control, or can be loaded from a rich text format (RTF) or plain text file. The text within the control can be assigned character and paragraph formatting.

The RichTextBox control provides a number of properties you can use to apply formatting to any portion of text within the control. To change the formatting of text, it must first be selected. Only selected text can be assigned character and paragraph formatting. Once a setting has been made to a selected section of text, all text entered after the selection is also formatted with the same settings until a setting change is made or a different section of the control's document is selected. The SelectionFont property enables you to make text bold or italic. You can also use this property to change the size and typeface of the text. The SelectionColor property enables you to change the color of the text. To create bulleted lists you can use the SelectionBullet property. You can also adjust paragraph formatting by setting the SelectionIndent, SelectionRightIndent, and SelectionHangingIndent properties.

The RichTextBox control provides methods that provide functionality for opening and saving files. The LoadFile method enables you to load an existing RTF or ASCII text file into the control. You can also load data from an already opened data stream. The SaveFile enables you to save a file to RTF or ASCII text. Similar to the LoadFile method, you can also use the SaveFile method to save to an open data stream. The RichTextBox control also provides features for finding strings of text. The Find method is overloaded to find both strings of text as well as specific characters within the text of the control.

If the text within the control contains links, such as a link to a Web site, you can use the DetectUrls property to display the link appropriately in the control's text. You can then handle the OnLinkClicked event to perform the tasks associated with the link. The SelectionProtected property enables you to protect text within the control from manipulation by the user. With protected text in your control, you can handle the Protected event to determine when the user has attempted to modify protected text, and either alert the user that the text is protected or provide the user with a standard way to manipulate the protected text.

PropertyGrid

A PropertyGrid control (TCnPropertyGrid) is a .Net control in Delphi which provides a user interface for browsing the properties of a .Net object or .Net VCL objects for Delphi.

The information displayed in the grid is a snapshot of the properties at the time the object is assigned. If a property value of the object specified by the SelectedObject is changed in code at run time, the new value is not displayed until an action is taken in the grid that causes the grid to refresh.

The property tabs within the property grid appear as buttons on the toolbar at the top of the TCnPropertyGrid, and can vary in scope as defined in the PropertyTabScope. You can use the LargeButtons property to display large buttons instead of the default smaller ones. Large buttons are 32-by-32 pixels rather than the standard 16-by-16 pixels.

TextBox

A TextBox control (TCnTextBox) is a .Net control in Delphi which is used to display, or accept as input, a single line of text. This control has additional functionality that is not found in the standard Windows text box control, including multiline editing and password character masking.

Typically, a TCnTextBox control is used to display, or accept as input, a single line of text. You can use the Multiline and ScrollBars properties to enable multiple lines of text to be displayed or entered. Set the AcceptsTab and AcceptsReturn properties to true to enable greater text manipulation in a multiline TextBox control.

You can limit the amount of text entered into a TextBox control by setting the MaxLength property to a specific number of characters. TCnTextBox controls can also be used to accept passwords and other sensitive information. You can use the PasswordChar property to mask characters entered in a single-line version of the control. Use the CharacterCasing property to enable the user to type only uppercase, only lowercase, or a combination of uppercase and lowercase characters into the TextBox control.

To scroll the contents of the TCnTextBox until the cursor (caret) is within the visible region of the control, you can use the ScrollToCaret method. To select a range of text in the text box, you can use the Select method.

To restrict text from being entered in a TCnTextBox control, you can create an event handler for the KeyDown event in order to validate each character entered in the control. You can also restrict all entry of data in a TCnTextBox control by setting the ReadOnly property to true.

TrackBar

A TrackBar control (TCnTrackBar) is a .Net control in Delphi which provides a slider control. It allows the user to select a value from the slider by dragging on it.

The TCnTrackBar is a scrollable control similar to the ScrollBar control. You can configure ranges through which the value of the Value property of a track bar scrolls by setting the Minimum property to specify the lower end of the range and the Maximum property to specify the upper end of the range.

The LargeChange property defines the increment to add or subtract from the Value property when clicks occur on either side of the scroll box. The track bar can be displayed horizontally or vertically.

You can use this control to input numeric data obtained through the Value property. You can display this numeric data in a control or use it in code.

CheckedListBox

A CheckedListBox control (TCnCheckedListBox) is a .Net control in Delphi which displays a ListBox in which a check box is displayed to the left of each item.

The user can place a check mark by one or more items and the checked items can be navigated with the TCnCheckedListBox.CheckedItemCollection and TCnCheckedListBox.CheckedIndexCollection.

You can add individual items to the list with the Add method. The TCnCheckedListBox object supports three states through the CheckState enumeration: Checked, Indeterminate, and Unchecked.

  CnCheckedListBox3.Add('.Net', TCheckState.csIndeterminate);
  CnCheckedListBox3.Add('Delphi', TCheckState.csUnchecked);
  CnCheckedListBox3.Add('C#', TCheckState.csIndeterminate);
  CnCheckedListBox3.Add('Java');
  CnCheckedListBox3.Add('VB6');
  CnCheckedListBox3.Add('VB.Net');
  CnCheckedListBox3.Add('Pascal');

ComboBox

A ComboBox control (TCnComboBox) is a .Net control in Delphi which provides combined functionality of a text box and a listbox in a single control. Only one list item is displayed at one time in a TCnComboBox and rest of the available items are loaded in a drop down list.

A TCnComboBox displays a text box combined with a ListBox, which enables the user to select items from the list or enter a new value.

The DropDownStyle property specifies whether the list is always displayed or whether the list is displayed in a drop-down. The DropDownStyle property also specifies whether the text portion can be edited. There is no setting to always display the list and disallow entering a new value. To display a list to which no new values can be added, use a TCnListBox control.

The TCnComboBox allows users to perform case-sensitive autocompletion. The control has built-in support to suggest items that starts with text or contains.

To add or remove strings in the list at run time, use the Items property of the TCnComboBox.

In addition to display and selection functionality, the TCnComboBox also provides features that enable you to efficiently add items to the ComboBox and to find text within the items of the list. With the BeginUpdate and EndUpdate methods, you can add a large number of items to the TCnComboBox without the control being repainted each time an item is added to the list. The FindString and FindStringExact methods enable you to search for an item in the list that contains a specific search string.

You can use these properties to manage the currently selected item in the list, the Text property to specify the string displayed in the editing field, the SelectedIndex property to get or set the current item, and the SelectedItem property to get or set a reference to the object.

ListBox

A ListBox control (TCnListBox) is a .Net control in Delphi which provides a user interface to display a list of items. Users can select one or more items from the list. A TCnListBox may be used to display multiple columns and these columns may have images and other controls.

More than one item in a TCnListBox is visible, unlike the TCnComboBox, which has only the selected item visible unless the IsDropDownOpen property is true. The SelectionMode property determines whether more than one item in the TCnListBox is selectable at a time.

The SelectionMode property determines how many items a user can select at one time. You can set the property to Single (the default), Multiple, or Extended.

ListView

A ListView control (TCnListView) is a .Net control in Delphi which provides an interface to display a list of items using different views including text, small images, and large images.

A ListView control allows you to display a list of items with item text and, optionally, an icon to identify the type of item. For example, the Windows Explorer list of files is similar in appearance to a ListView control. It displays a list of the files and folders currently selected in the tree. Each file and folder displays an icon associated with it to help identify the type of file or folder.

The TCnListViewItem class represents an item within a ListView control. The items that are displayed in the list can be shown in one of five different views. Items can be displayed as large icons, as small icons, or as small icons in a vertical list. Items can also have subitems which contain information that is related to the parent item. The details view allows you to display the item and its subitems in a grid with column headers that identify the information being displayed in a subitem. The tile view, which has limited availability as described below, allows you to display the item and its subitems as a tile that contains a large icon next to the textual information. TCnListView supports single or multiple selection. The multiple selection feature lets the user select from a list of items in a way similar to a TCnListBox control.

Additionally, the user can activate selected items to perform a task. For example, you could use a ListView control to display a list of files that the application can then open and utilize. The user can select the files to open and then double-click them to activate the items and open the files in the application. The TCnListView can also display check boxes, using the CheckBoxes property, to allow the user to check the items that they want to perform an action on. You can use the ListView control in a variety of ways. The control can be used to display information from an application, a database, or a text file. The ListView can also be used to obtain information from the user, such as selecting a set of files to process.

TCnListView provides a large number of properties that provide flexibility in appearance and behavior. The View property allows you to change the way in which items are displayed. The LargeImageList, SmallImageList, and StateImageList properties allow you to specify the ImageList objects that contain the images displayed for items and, in the case of the StateImageList, the check boxes that are displayed when the CheckBoxes property is set to true. To determine which items are checked, you can use the CheckedItems property to access the TCnListView.CheckedItems collection. The Columns property allows access to the TCnListView.Columns, which stores the column headers that are displayed when the View property of the control is set to Details. Items are added and removed from the TCnListView through the Items property. The Items property allows you to access the ListViewItemCollection of the control, which provides methods for manipulating the items in the control. If you want to allow the user to edit the text of an item, you can use the LabelEdit property. When your control contains a large number of items, it is often easier for the user to see them in a sorted list. You can use the Sorting property to sort the items alphabetically. You can also completely customize the appearance of a TCnListView control. To do this, set the OwnerDraw property to true and handle one or more of the following events: OnDrawItem, OnDrawSubItem, OnDrawColumnHeader.

Many of the properties of the TCnListView control are used when the View property of the control is set to Details. The AllowColumnReorder property allows the user of your TCnListView control to reconfigure the order of columns at run time. The FullRowSelect property allows an item and its subitems to be selected instead of just the item. To display gridlines in the details view to identify the boundaries of items and subitems in the TCnListView, you can use the GridLines property. The HeaderStyle property allows you to specify the type of column headers to display.

A ListView control can operate in virtual mode, where ListViewItem objects are generated dynamically instead of being stored in the Items collection. This can be useful for dealing with very large lists or lists whose contents frequently change. To enable Virtual mode, set the VirtualMode property to true and handle the OnRetrieveVirtualItem, OnCacheVirtualItems, and OnSearchForVirtualItem events.

In addition to the many properties that are available for a ListView control, there are methods and events that your application can use to provide additional capabilities to the TCnListView. The BeginUpdate and EndUpdate methods allow you to improve performance when you add many items to a TCnListView by preventing the control from repainting every time that an item is added. If your TCnListView control is displaying items and subitems, you may want to provide functionality when the user right-clicks a subitem. To determine the item whose subitem is being clicked, you can use the GetItemAt method. When performing validation of the items after the user has edited them, you may want to display a specific item to the user to change. The EnsureVisible method can be called to ensure that the specific item is in the visible area of the control.

If the LabelEdit property set to true, you can perform tasks such as validating the text being edited before and after the text changed by creating an event handler for the BeforeLabelEdit and AfterLabelEdit events. To perform tasks such as opening a file or displaying a dialog box to edit an item displayed in a TCnListView, you can create an event handler for the OnItemActivate event. If you allow the user to sort the items in a TCnListView when they click a column header, you can create an event handler for the OnColumnClick event to perform the sorting. When the CheckBoxes property is set to true, you can determine when a change in an item's check state has occurred by handling the OnItemCheck event.

ImageList

A ImageList control (TCnImageList) is a .Net control in Delphi which provides a container for image data. The control is not visible directly. It is instead referenced from other controls such as TCnListView, which acquire the images from index values into the ImageList.

TCnImageList is typically used by other controls, such as the TCnListView, TCnTreeView, or TCnToolBar. You can add bitmaps or icons to the TCnImageList, and the other controls are able to use the images as they require.

TCnImageList uses a handle to manage the list of images. The Handle is not created until certain operations, such as getting the Handle or calling Draw, are performed on the image list. Performing other operations, such as setting the ColorDepth or ImageSize will cause the Handle to be recreated. Therefore, you should perform these operations before you add images to the ImageList.

Label

A Label control (TCnLabel) is a .Net control in Delphi which are used to display text or images that cannot be edited by the user. TCnLabel is used to identify objects on a form which provides a description of what a certain control will do if clicked, for example, or to display information in response to a run-time event or process in your application. Because the Label control cannot receive focus, it can also be used to create access keys for other controls..

A Label control is typically used to provide descriptive text for a control. For example, you can use a TCnLabel to add descriptive text for a TextBox control to inform the user about the type of data expected in the control. Label control can also be used to add descriptive text to a Form to provide the user with helpful information. For example, you can add a TCnLabel to the top of a Form that provides instructions to the user on how to input data in the controls on the form. A TCnLabel control can be also used to display run time information on the status of an application. For example, you can add a TCnLabel control to a form to display the status of each file as a list of files is processed.

A TCnLabel participates in the tab order of a form, but does not receive focus (the next control in the tab order receives focus). For example, if the UseMnemonic property is set to true, and a mnemonic character—the first character after an ampersand (&)—is specified in the Text property of the control, when a user presses ALT+ the mnemonic key, focus moves to the next control in the tab order. This feature provides keyboard navigation for a form. In addition to displaying text, the Label control can also display an image using the Image property, or a combination of the ImageIndex and ImageList properties.

LinkLabel

A LinkLabel control (TCnLinkLabel) is a .Net control in Delphi which enables you to add Web-style links to VCL Forms applications. You can use the TCnLinkLabel control for everything that you can use the Label control for; you also can set part of the text as a link to an object or Web page. .

The TCnLinkLabel control is similar to a TCnLabel control with the exception that it can display a hyperlink. Multiple hyperlinks can be specified in the text of the control. Each hyperlink can perform a different task within an application. For example, you can use a hyperlink to display a Web site in Microsoft Internet Explorer or to load a log file associated with an application.

Each hyperlink displayed in the TCnLinkLabel control is an instance of the _Link interface. The _Link interface defines display information, state, and location of the hyperlink. In addition, the LinkData property of the _Link interface enables you to associate information, such as a URL to display, with the hyperlink. When a user clicks a hyperlink within the control, the OnLinkClicked event is raised, and the _Link object representing the hyperlink that was clicked is passed as part of the LinkLabelLinkClickedEventArgs object that is passed as a parameter to the event handler. You can use this object to obtain the _Link object associated with the hyperlink that was clicked by the user. All hyperlinks contained within the LinkLabel control are stored in the _LinkCollection interface instance for the control.

There are two ways to add a hyperlink to the LinkLabel control. The quickest way is to specify a LinkArea and assign it to the LinkArea property. This enables you to specify a single hyperlink within the text of the control. To add multiple hyperlinks, you can use the Add method of the _LinkCollection interface by accessing the collection through the Links property.

When a TCnLinkLabel control is created, a default hyperlink that contains all the text within the LinkLabel control is added to the _LinkCollection. You can override this default link by specifying a new link area with the LinkArea property, or specify a link using the Add method of the _LinkCollection. You can also remove the default hyperlink by using the Remove method of the _LinkCollection interface.

The TabStop property is true by default, as long as there is at least one link of greater than zero length in the Links collection. The LinkLabel control has a single TabIndex value. However, each link of greater than zero length gets its own tab stop, in left-to-right order. To prevent tab navigation to the LinkLabel control, set the TabStop property to false. However, be aware that adding new links to the Links collection will automatically set the TabStop property to true again.

The TCnLinkLabel provides a number of properties that enable you to define the display appearance of hyperlinks in the control. The ActiveLinkColor, DisabledLinkColor, LinkColor, and VisitedLinkColor properties define the colors used when displaying a hyperlink in various states. The LinkBehavior property defines the display of the underline that is associated with a hyperlink.

MonthCalendar

A MonthCalendar control (TCnMonthCalendar) is a .Net control in Delphi which presents an intuitive graphical interface for users to view and set date information. The control displays a grid containing the numbered days of the month, arranged in columns underneath the days of the week. You can select a different month by clicking the arrow buttons on either side of the month caption. Unlike the similar TCnDateTimePicker control, you can select a range of dates with this control; however, the TCnDateTimePicker control allows you to set times as well as dates..

The TCnMonthCalendar control allows the user to select a date using a visual display. You can limit the date and times that can be selected by setting the MinDate and MaxDate properties.

You can change the look of the calendar portion of the control by setting the ForeColor, Font, TitleBackColor, TitleForeColor, TrailingForeColor, and BackColor properties.

The TCnMonthCalendar control is drawn by the operating system, so the OnPaint event is never raised.

If you need custom date formatting and a selection limited to just one date, you might consider using a TCnDateTimePicker control instead of a TCnMonthCalendar. Using the TCnDateTimePicker eliminates much of the need for validating date/time values.

DateTimePicker

A DateTimePicker control (TCnDateTimePicker) is a .Net control in Delphi which allows the user to select a single item from a list of dates or times. When used to represent a date, it appears in two parts: a drop-down list with a date represented in text, and a grid that appears when you click on the down-arrow next to the list.

The TCnDateTimePicker control is used to allow the user to select a date and time, and to display that date and time in the specified format. The TCnDateTimePicker control makes it easy to work with dates and times because it handles a lot of the data validation automatically.

The calendar looks like the TCnMonthCalendar control, which can be used for selecting multiple dates.

You can change the look of the calendar portion of the control by setting the CalendarForeColor, CalendarFont, CalendarTitleBackColor, CalendarTitleForeColor, CalendarTrailingForeColor, and CalendarMonthBackground properties.

To use a spin button control (also known as an up-down control) to adjust the date/time value, set the ShowUpDown property to true. The calendar will not drop down when the control is selected. The date and time can be adjusted by selecting each element individually and using the up and down buttons to change the value.

The Value property contains the current date and time the control is set to. You can use the Text property or the appropriate member of Value to get the date and time value. You can limit the dates and times that can be selected by setting the MinDate and MaxDate properties.

The values can be displayed in four formats, which are set by the Format property: Long, Short, Time, or Custom. The default date Format is TDateTimePickerFormat.dtpLong.

If you want the TCnDateTimePicker to appear as a control for picking or editing times instead of dates, set the ShowUpDown property to true and the Format property to Time.

If the Format property is set to TDateTimePickerFormat.dtpCustom, you can create your own format style by setting the CustomFormat property and building a custom format string. The custom format string can be a combination of custom field characters and other literal characters. For example, you can display the date as "June 01, 2012 - Friday" by setting the CustomFormat property to "MMMM dd, yyyy - dddd".

Button

A Button control (TCnButton) is a .Net control in Delphi which allows the user to click it to perform an action. The TCnButton control can display both text and images. When the button is clicked, it looks as if it is being pushed in and released.

A Button can be clicked by using the mouse, ENTER key, or SPACEBAR if the button has focus.

Set the Default to True to allow users to click a button by pressing the ENTER keys even if the button does not have focus.

You can change the button's appearance. For example, to make it appear flat for a Web look, set the FlatStyle property to TFlatStyle.fsFlat. The FlatStyle property can also be set to TFlatStyle.fsPopup, which appears flat until the mouse pointer passes over the button; then the button takes on the standard Windows button appearance.

WebBrowser

A WebBrowser control (TCnWebBrowser) is a .Net control in Delphi which hosts Web pages and provides Web browsing capabilities to your application.

The TCnWebBrowser control lets you host Web pages and other browser-enabled documents in your Delphi VCL Forms applications. You can use the TCnWebBrowser control, for example, to provide integrated HTML-based user assistance or Web browsing capabilities in your application. Additionally, you can use the TCnWebBrowser control to add your existing Web-based controls to your Delphi VCL Forms client applications.

The TCnWebBrowser control has several properties, methods, and events related to navigation. The following members let you navigate the control to a specific URL, move backward and forward through the navigation history list, and load the home page and search page of the current user:
  • Url
  • Navigate
  • GoBack
  • GoForward
  • GoHome
  • GoSearch

If the navigation is unsuccessful, a page indicating the problem is displayed. Navigation with any of these members causes the OnNavigating, OnNavigated, and OnDocumentCompleted events to occur at different stages of navigation.

These and other members, such as the Stop and Refresh methods, let you implement user interface controls in your application similar to those in Internet Explorer. Some members are useful even when you do not want to display the TCnWebBrowser control on your form. For example, you can use the Print method to print the latest version of a Web page without displaying the page to the user.

The TCnWebBrowser control also lets you display content that you create in your application or you retrieve from a database or resource file. Use the DocumentText or DocumentStream property to get or set the contents of the current document as a string or data stream.

You can also manipulate the contents of a Web page through the Document property, which contains an HtmlDocument object that provides managed access to the HTML document object model (DOM) for the current page. This property is useful, when used in combination with the ObjectForScripting property, to implement two-way communication between your application code and dynamic HTML (DHTML) code in a Web page, letting you combine Web-based controls and Delphi VCL Forms controls in a single user interface. You can use the Document property to call scripting code methods from your application. Your scripting code can access your application through the window.external object, which is a built-in DOM object provided for host access, and which maps to the object that you specify for the ObjectForScripting property.

ProgressBar

A ProgressBar control (TCnProgressBar) is a .Net control in Delphi which indicates the progress of an action by displaying an appropriate number of rectangles arranged in a horizontal bar. When the action is complete, the bar is filled. Progress bars are commonly used to give the user an indication of how long to wait for a protracted action to complete—for instance, when a large file is being loaded.

A TCnProgressBar control visually indicates the progress of a lengthy operation in one of three styles:
  • Segmented blocks that increase in steps from left to right.
  • A continuous bar that fills in from left to right.
  • A block that scrolls across a ProgressBar in a marquee fashion.

The Style property determines the style of TCnProgressBar that is displayed. Note that the TCnProgressBar control can only be oriented horizontally. The TCnProgressBar control is typically used when an application performs tasks such as copying files or printing documents. Users of an application might consider an application unresponsive if there is no visual cue. By using the TCnProgressBar in your application, you alert the user that the application is performing a lengthy task and that the application is still responding.

The Maximum and Minimum properties define the range of values to represent the progress of a task. The Minimum property is typically set to a value of 0, and the Maximum property is typically set to a value indicating the completion of a task. For example, to properly display the progress when copying a group of files, the Maximum property could be set to the total number of files to be copied.

The Value property represents the progress that the application has made toward completing the operation. The value displayed by the TCnProgressBar only approximates the current value of the Value property. Based on the size of the TCnProgressBar, the Value property determines when to display the next block or increase the size of the bar.

There are a number of ways to modify the value displayed by the TCnProgressBar other than changing the Value property directly. You can use the Step property to specify a specific value to increment the Value property by, and then call the PerformStep method to increment the value. To vary the increment value, you can use the Increment method and specify a value with which to increment the Value property.

ToolTip

A ToolTip component (TCnToolTip) is a .Net component in Delphi which displays text when the user points at controls. A ToolTip can be associated with any .Net Control Suite. An example use of this control: In order to save space on a form, you can display a small icon on a button and use a ToolTip to explain the button's function.

With the TCnToolTip, you can provide hints to a user when the user places the pointer on a control. The TCnToolTip is typically used to alert users to the intended use of a control. For example, you can specify ToolTip text for a TextBox control that accepts a name, specifying the format of the name to be typed into the control. In addition to providing hints, you can also use the TCnToolTip to provide run time status information. For example, you can use the TCnToolTip to display connection speed and line quality data when the user moves the pointer onto a TCnPictureBox control that displays Internet connection status.

A single TCnToolTip component typically is used to create ToolTips for multiple controls on a single form. After you create a TCnToolTip, use a separate call to the SetToolTip method to associate ToolTip display text to an individual control. Then when the user moves the pointer on a control, the ToolTip with its text is displayed. You can call SetToolTip more than once for the same control to change the text that is associated with the control. To get the text that is associated with a control, use the GetToolTip method. To remove all ToolTip text associations with an instance of the TCnToolTip, use the RemoveAll method.

DataGridView

A DataGridView control (TCnDataGridView) is a .Net control in Delphi which displays data in a customizable grid. The TCnDataGridView control provides a powerful and flexible way to display data in a tabular format. You can use the TCnDataGridView control to show read-only views of a small amount of data, or you can scale it to show editable views of very large sets of data. This control also let's you display data in a master-details view.

The TCnDataGridView control can also be used in unbound mode, with no underlying data store. The TCnDataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. When you want your Windows Forms application to display tabular data, consider using the TCnDataGridView control. If you are displaying a small grid of read-only values, or if you are enabling a user to edit a table with millions of records, the TCnDataGridView control will provide you with a readily programmable, memory-efficient solution.

The following code example demonstrates how to initialize an unbound TCnDataGridView control.

****************** DFM ************************
object Form1: TForm1
  Left = 0
  Top = 0
  BorderIcons = [biSystemMenu, biMaximize]
  Caption = 'Load DataSet Interface into DataGridView'
  ClientHeight = 409
  ClientWidth = 550
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  DesignSize = (
    550
    409)
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 257
    Top = 383
    Width = 53
    Height = 13
    Caption = 'TableName'
  end
  object ButtonLoadData: TButton
    Left = 467
    Top = 377
    Width = 75
    Height = 25
    Anchors = [akRight, akBottom]
    Caption = 'Load Data'
    TabOrder = 0
    OnClick = ButtonLoadDataClick
  end
  object cboTableName: TComboBox
    Left = 316
    Top = 379
    Width = 145
    Height = 21
    Style = csDropDownList
    Anchors = [akRight, akBottom]
    TabOrder = 1
  end
  object CnDataGridView1: TCnDataGridView
    Left = 0
    Top = 27
    Width = 550
    Height = 347
    Anchors = [akLeft, akTop, akRight, akBottom]
    Location.Y = 27
    Size.Width = 550
    Size.Height = 347
    TabOrder = 2
    AlternatingRowsDefaultCellStyle.BackColor.HexCode = 'LightGoldenrodYellow'
    AlternatingRowsDefaultCellStyle.BackColor.Name = 'LightGoldenrodYellow'
    AlternatingRowsDefaultCellStyle.NullValue = ''
    ColumnHeadersHeight = 23
    BindingSource = CnBindingSource1
  end
  object CnBindingNavigator1: TCnBindingNavigator
    Left = 0
    Top = 0
    Width = 550
    Height = 27
    Align = alTop
    CnDock = dsTop
    Size.Width = 550
    Size.Height = 27
    TabOrder = 3
    Text = 'CnBindingNavigator1'
    BindingSource = CnBindingSource1
  end
  object CnBindingSource1: TCnBindingSource
    Left = 184
    Top = 184
  end
end
*********************** PAS **************************
unit uDataGridView;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
{$IF CompilerVersion > 22}
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
{$ELSE}
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls,
{$IFEND}
  CNClrLib.Windows, CNClrLib.Data, CNClrLib.Control.EnumTypes, CNClrLib.Control.EventArgs,
  CNClrLib.Control.Base, CNClrLib.Component.BindingSource, CNClrLib.Control.ScrollableControl,
  CNClrLib.Control.ToolStrip, CNClrLib.Control.BindingNavigator, CNClrLib.Control.DataGridView;

type
  TForm1 = class(TForm)
    ButtonLoadData: TButton;
    cboTableName: TComboBox;
    Label1: TLabel;
    CnDataGridView1: TCnDataGridView;
    CnBindingNavigator1: TCnBindingNavigator;
    CnBindingSource1: TCnBindingSource;
    procedure FormCreate(Sender: TObject);
    procedure ButtonLoadDataClick(Sender: TObject);
  private
    FDataSet: _DataSet;

    procedure MakeChildTable;
    procedure MakeDataRelation;
    procedure MakeDataTables;
    procedure MakeParentTable;
    procedure AddTableNames;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses CNClrLib.Host, CNClrLib.Enums;

procedure TForm1.MakeParentTable;
var
  table: _DataTable;
  column: _DataColumn;
  row: _DataRow;
  primaryKeyColumns: _DataColumnArray;
  I: Integer;
begin
  // Create a new DataTable.
  table := CoDataTable.CreateInstance('ParentTable');

  // Create new DataColumn, set DataType,
  // ColumnName and add to DataTable.
  column := CoDataColumn.CreateInstance;
  column.DataType := TClrAssembly.GetType('System.Int32');
  column.ColumnName := 'id';
  column.ReadOnly_ := true;
  column.Unique := true;
  // Add the Column to the DataColumnCollection.
  table.Columns.Add(column);

  // Create second column.
  column := CoDataColumn.CreateInstance;
  column.DataType := TClrAssembly.GetType('System.String');
  column.ColumnName := 'ParentItem';
  column.AutoIncrement := false;
  column.Caption := 'ParentItem';
  column.ReadOnly_ := false;
  column.Unique := false;
  // Add the column to the table.
  table.Columns.Add(column);

  // Make the ID column the primary key column.
  primaryKeyColumns := CoDataColumnArray.CreateInstance(1);
  primaryKeyColumns[0] := table.Columns.Item_1['id'];
  table.PrimaryKey := primaryKeyColumns;

  // Instantiate the FDataSet variable.
  FDataSet := CoDataSet.CreateInstance;
  // Add the new DataTable to the FDataSet.
  FDataSet.Tables.Add(table);

  // Create three new DataRow objects and add
  // them to the DataTable
  for I := 0 to 2 do
  begin
    row := table.NewRow;
    row.Item_1['id'] := i;
    row.Item_1['ParentItem'] := 'ParentItem ' + IntToStr(i);
    table.Rows.Add(row);
  end;
end;

procedure TForm1.MakeChildTable;
var
  table: _DataTable;
  column: _DataColumn;
  row: _DataRow;
  I: Integer;
begin
  // Create a new DataTable.
  table := CoDataTable.CreateInstance('childTable');

  // Create first column and add to the DataTable.
  column := CoDataColumn.CreateInstance;
  column.DataType := TClrAssembly.GetType('System.Int32');
  column.ColumnName := 'ChildID';
  column.AutoIncrement := true;
  column.Caption := 'ID';
  column.ReadOnly_ := true;
  column.Unique := true;

  // Add the column to the DataColumnCollection.
  table.Columns.Add(column);

  // Create second column.
  column := CoDataColumn.CreateInstance;
  column.DataType := TClrAssembly.GetType('System.String');
  column.ColumnName := 'ChildItem';
  column.AutoIncrement := false;
  column.Caption := 'ChildItem';
  column.ReadOnly_ := false;
  column.Unique := false;
  table.Columns.Add(column);

  // Create third column.
  column := CoDataColumn.CreateInstance;
  column.DataType := TClrAssembly.GetType('System.Int32');
  column.ColumnName := 'ParentID';
  column.AutoIncrement := false;
  column.Caption := 'ParentID';
  column.ReadOnly_ := false;
  column.Unique := false;
  table.Columns.Add(column);

  FDataSet.Tables.Add(table);

  // Create three sets of DataRow objects,
  // five rows each, and add to DataTable.
  for I := 0 to 4 do
  begin
    row := table.NewRow;
    row.Item_1['childID'] := i;
    row.Item_1['ChildItem'] := 'Item ' + IntToStr(i);
    row.Item_1['ParentID'] := 0;
    table.Rows.Add(row);
  end;

  for I := 0 to 4 do
  begin
    row := table.NewRow;
    row.Item_1['childID'] := i + 5;
    row.Item_1['ChildItem'] := 'Item ' + IntToStr(i);
    row.Item_1['ParentID'] := 1;
    table.Rows.Add(row);
  end;

  for I := 0 to 4 do
  begin
    row := table.NewRow;
    row.Item_1['childID'] := i + 10;
    row.Item_1['ChildItem'] := 'Item ' + IntToStr(i);
    row.Item_1['ParentID'] := 2;
    table.Rows.Add(row);
  end;
end;

procedure TForm1.MakeDataRelation;
var
  parentColumn,
  childColumn: _DataColumn;
  relation: _DataRelation;
begin
  // DataRelation requires two DataColumn
  // (parent and child) and a name.
  parentColumn := FDataSet.Tables.Item_1['ParentTable'].Columns.Item_1['id'];
  childColumn := FDataSet.Tables.Item_1['ChildTable'].Columns.Item_1['ParentID'];
  relation := CoDataRelation.CreateInstance('parent2Child', parentColumn, childColumn);
  FDataSet.Tables.Item_1['ChildTable'].ParentRelations.Add(relation);
end;

procedure TForm1.MakeDataTables;
begin
  MakeParentTable;
  MakeChildTable;
  MakeDataRelation;
  AddTableNames;
end;

procedure TForm1.AddTableNames;
var
  I: Integer;
begin
  for I := 0 to FDataSet.Tables.Count - 1 do
    cboTableName.Items.Add(FDataSet.Tables[i].TableName);

  cboTableName.ItemIndex := 0;
end;

procedure TForm1.ButtonLoadDataClick(Sender: TObject);
begin
  CnBindingSource1.DataSource := FDataSet.Tables[cboTableName.ItemIndex];
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MakeDataTables;
end;

end.

The TCnDataGridView control provides a customizable table for displaying data. The TCnDataGridView control allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.

You can use a TCnDataGridView control to display data with or without an underlying data source. Without specifying a data source, you can create columns and rows that contain data and add them directly to the TCnDataGridView using the Rows and Columns properties. You can also use the Rows collection to access DataGridViewRow objects and the DataGridViewRow.Cells property to read or write cell values directly. The Item[String, Integer] indexer also provides direct access to cells.

As an alternative to populating the control manually, you can set the DataSource and DataMember properties to bind the TCnDataGridView to a data source and automatically populate it with data.

When working with very large amounts of data, you can set the VirtualMode property to true to display a subset of the available data. Virtual mode requires the implementation of a data cache from which the TCnDataGridView control is populated.

BindingNavigator

A BindingNavigator control (TCnBindingNavigator) is a .Net control in Delphi which represents the navigation and manipulation user interface (UI) for controls on a form that are bound to data.

The following code example demonstrates how to use a TCnBindingNavigator control to move through a data set. The set is contained in a DataView, which is bound to a TCnTextBox control with a BindingSource component.

unit uBindingNavigator;

// This form demonstrates using a TCnBindingNavigator to display
// rows from a database query sequentially.

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, CNClrLib.Control.EnumTypes,
  CNClrLib.Control.EventArgs, CNClrLib.Control.Base,
  CNClrLib.Control.ScrollableControl, CNClrLib.Control.ToolStrip,
  CNClrLib.Control.BindingNavigator, CNClrLib.Component.BindingSource,
  CNClrLib.Control.TextBoxBase, CNClrLib.Control.TextBox;

type
  TfrmBindingNav = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    customersBindingNavigator : TCnBindingNavigator;
    customersBindingSource: TCnBindingSource;
    companyNameTextBox: TCnTextBox;
  public
    { Public declarations }
  end;

var
  frmBindingNav: TfrmBindingNav;

implementation

{$R *.dfm}

uses CNClrLib.Data, CNClrLib.Windows;

procedure TfrmBindingNav.FormCreate(Sender: TObject);
begin
  // This is the BindingNavigator that allows the user
  // to navigate through the rows in a DataSet.
  customersBindingNavigator := TCnBindingNavigator.Create(Self);

  // This is the BindingSource that provides data for
  // the Textbox control.
  customersBindingSource := TCnBindingSource.Create(Self);

  // This is the TextBox control that displays the CompanyName
  // field from the DataSet.
  companyNameTextBox := TCnTextBox.Create(Self);

  // Set up the BindingSource component.
  customersBindingNavigator.BindingSource := customersBindingSource;
  customersBindingNavigator.Align := alTop;
  customersBindingNavigator.Parent := Self;

  // Set up the TextBox control for displaying company names.
  companyNameTextBox.Align := alBottom;
  companyNameTextBox.Parent := Self;
end;

procedure TfrmBindingNav.FormShow(Sender: TObject);
var
  connectString: String;
  connection: _SqlConnection;
  dataAdapter1: _SqlDataAdapter;
  ds: _DataSet;
begin
  // Open a connection to the database.
  // Replace the value of connectString with a valid
  // connection string to a Northwind database accessible
  // to your system.
  connectString := 'Integrated Security=SSPI;Persist Security Info=False;' +
      'Initial Catalog=Northwind;Data Source=localhost';

  connection := CoSqlConnection.CreateInstance(connectString);
  try
    dataAdapter1 := CoSqlDataAdapter.CreateInstance(CoSqlCommand.CreateInstance('Select * From Customers', connection));

    ds := CoDataSet.CreateInstance('Northwind Customers');
    ds.Tables.Add_1('Customers');
    dataAdapter1.Fill_3(ds.Tables.Item_1['Customers']);

    // Assign the DataSet as the DataSource for the BindingSource.
    customersBindingSource.DataSource := ds.Tables.Item_1['Customers'];

    // Bind the CompanyName field to the TextBox control.
    companyNameTextBox.DataBindings.Add(
        CoBinding.CreateInstance('Text',
          customersBindingSource.BindingSource,//.Unwrap,
          'CompanyName',
          True));
  finally
    connection.Dispose;
  end;
end;

end.

The TCnBindingNavigator control represents a standardized way to navigate and manipulate data on a form. In most cases, a TCnBindingNavigator is paired with a TCnBindingSource control to move through data records on a form and interact with them. In these cases, the TCnBindingSource property is set to the associated TCnBindingSource component that acts as a data source.

By default, the TCnBindingNavigator control's user interface (UI) is composed of a series of TCnCustomToolStrip buttons, text boxes, and static text elements for most common data-related actions, such as adding data, deleting data, and navigating through data. Each of these controls can be retrieved or set through an associated member of the TCnBindingNavigator control. Likewise, there is also a one-to-one correspondence to members within the TCnBindingSource class that programmatically perform the same functionality.

The TCnBindingNavigator can be used to Bind the Database Tables values to the control (TCnDataGridView,TCnTextBox, TCnLabel and so on).
There are a few buttons in a Binding Navigator as listed below:
  • Move First: Go to the first record of the table.
  • Move Next: Go to the next record of the table with respect to the current record.
  • Move Previous: Go to the previous record of the table.
  • Move Last: Go to the last record of the table.
  • Delete: Delete selected row (record).
  • Add New: Add a new row.
  • Tool Strip: You can add button, Label, Image and TextBox and so on.
  • Position Item: current row count.
  • Count Item: Total Number of rows in database table.

BindingSource

A BindingSource component (TCnBindingSource) is a .Net component in Delphi which encapsulates the data source for a form.

The TCnBindingSource component is designed to simplify the process of binding controls to an underlying data source. The TCnBindingSource component acts as both a conduit and a data source for other .Net controls in Delphi to bind to. It provides an abstraction of your form's data connection while passing through commands to the underlying list of data. Additionally, you can add data directly to it, so that the component itself functions as a data source.

The TCnBindingSource component serves many purposes. First, it simplifies binding controls on a form to data by providing currency management, change notification, and other services between Windows Forms controls and data sources. This is accomplished by attaching the TCnBindingSource component to your data source using the DataSource property. For complex binding scenarios you can optionally set the DataMember property to a specific column or list in the data source. You then bind controls to the TCnBindingSource. All further interaction with the data is accomplished with calls to the TCnBindingSource component. Navigation and updating of the data source is accomplished through methods such as MoveNext, MoveLast, and Remove. Operations such as sorting and filtering are handled through the Sort and Filter properties.

TCnBindingSource provides members for accessing the underlying data. The current item can be retrieved through the Current property, and the entire list can be retrieved through the List property. Editing operations are supported on the current item through Current and the RemoveCurrent, EndEdit, CancelEdit and Add and AddNew methods. Although currency management is handled automatically for all underlying data source types, this component exposes a number of events, such as OnCurrentItemChanged and OnDataSourceChanged, that allow for customization.

Data sources that are bound to a TCnBindingSource component can also be navigated and managed with the TCnBindingNavigator component, which provides a VCR-like user interface (UI) for navigating items within a list. Although TCnBindingNavigator can be bound to any data source, it was designed to integrate with a TCnBindingSource component through its TCnBindingNavigator.BindingSource property.

The default property for the TCnBindingSource component is DataSource. The default event is OnCurrentChanged.