Infragistics(R) NetAdvantage(R) Windows Forms
UltraCombo Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : UltraCombo Class

The UltraCombo control is like a ComboBox control, but the list is a multi-column, grid-like dropdown list.

Syntax

Visual Basic (Declaration) 
Public Class UltraCombo 
   Inherits UltraDropDownBase
   Implements Infragistics.Shared.IUltraLicensedComponent, Infragistics.Shared.Serialization.ICodeDomSerializable, Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.CalcEngine.IUltraCalcParticipant, Infragistics.Win.ICheckedItemList, Infragistics.Win.IDropDownResizeHandleOwner, Infragistics.Win.IFilterableValueList, Infragistics.Win.IProvideItemImageSize, Infragistics.Win.IProvidesEmbeddableEditor, Infragistics.Win.ISelectionManager, Infragistics.Win.ISupportPresets, Infragistics.Win.IUIElementProvider, Infragistics.Win.IUIElementTextProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.IValueList 
C# 
public class UltraCombo : UltraDropDownBase, Infragistics.Shared.IUltraLicensedComponent, Infragistics.Shared.Serialization.ICodeDomSerializable, Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.CalcEngine.IUltraCalcParticipant, Infragistics.Win.ICheckedItemList, Infragistics.Win.IDropDownResizeHandleOwner, Infragistics.Win.IFilterableValueList, Infragistics.Win.IProvideItemImageSize, Infragistics.Win.IProvidesEmbeddableEditor, Infragistics.Win.ISelectionManager, Infragistics.Win.ISupportPresets, Infragistics.Win.IUIElementProvider, Infragistics.Win.IUIElementTextProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.IValueList  

Example

Following code initializes the ultraCombo1. It sets some of the commonly used properties of UltraCombo.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

      Me.oleDbDataAdapter1.Fill(Me.DataSet11)

      ' Following code initializes the control.

      ' Bind the combo to a data source.
      Me.ultraCombo1.DataSource = Me.DataSet11
      Me.ultraCombo1.DataMember = ""

      ' Set the ValueMember and DisplayMember to appropriate column keys.
      Me.ultraCombo1.ValueMember = "ProductID"
      Me.ultraCombo1.DisplayMember = "ProductName"

      ' Set the border style of the edit portion by setting BorderStyle property
      ' off the UltraCombo. BorderStyle property off the DisplayLayout is for
      ' the border of the drop down window.
      Me.ultraCombo1.BorderStyle = UIElementBorderStyle.Solid
      Me.ultraCombo1.DisplayLayout.BorderStyle = UIElementBorderStyle.Solid

      ' Turn on the auto-editing. With this turned on, the UltraCombo will
      ' automatically find a matching item as the user types in.
      Me.ultraCombo1.AutoEdit = True

      ' Set the drop down style.
      Me.ultraCombo1.DropDownStyle = UltraComboStyle.DropDown

      ' Set the appearance of the UltraCombo's edit portion.
      Me.ultraCombo1.Appearance.FontData.Bold = DefaultableBoolean.True
      Me.ultraCombo1.Appearance.ForeColor = Color.Maroon

      ' Set the appearance of the UltraCombo's drop down portion.
      Me.ultraCombo1.DisplayLayout.Appearance.ForeColor = Color.DarkBlue

      ' Set the min and max drop down items.
      Me.ultraCombo1.MinDropDownItems = 5
      Me.ultraCombo1.MaxDropDownItems = 10

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void Form1_Load(object sender, System.EventArgs e)
{

	this.oleDbDataAdapter1.Fill( this.dataSet11 );
	this.oleDbDataAdapter2.Fill( this.dataSet21 );
	this.oleDbDataAdapter3.Fill( this.dataSet21 );
	this.oleDbDataAdapter4.Fill( this.dataSet21 );

	// Following code initializes the control.

	// Bind the combo to a data source.
	this.ultraCombo1.DataSource = this.dataSet11;
	this.ultraCombo1.DataMember = "";

	// Set the ValueMember and DisplayMember to appropriate column keys.
	this.ultraCombo1.ValueMember   = "ProductID";
	this.ultraCombo1.DisplayMember = "ProductName";

	// Set the border style of the edit portion by setting BorderStyle property
	// off the UltraCombo. BorderStyle property off the DisplayLayout is for
	// the border of the drop down window.
	this.ultraCombo1.BorderStyle = UIElementBorderStyle.Solid;
	this.ultraCombo1.DisplayLayout.BorderStyle = UIElementBorderStyle.Solid;
	
	// Turn on the auto-editing. With this turned on, the UltraCombo will
	// automatically find a matching item as the user types in.
	this.ultraCombo1.AutoEdit = true;

	// Set the drop down style.
	this.ultraCombo1.DropDownStyle = UltraComboStyle.DropDown;

	// Set the appearance of the UltraCombo's edit portion.
	this.ultraCombo1.Appearance.FontData.Bold = DefaultableBoolean.True;
	this.ultraCombo1.Appearance.ForeColor = Color.Maroon;

	// Set the appearance of the UltraCombo's drop down portion.
	this.ultraCombo1.DisplayLayout.Appearance.ForeColor = Color.DarkBlue;

	// Set the min and max drop down items.
	this.ultraCombo1.MinDropDownItems = 5;
	this.ultraCombo1.MaxDropDownItems = 10;

}

Remarks

The UltraCombo control can be used as the UltraGridColumn.ValueList of an UltraGrid column, but it is intended for use as a standalone control on a form. To provide a multi-column dropdown list in a grid cell, use the UltraDropDown control.

The UltraCombo is populated by binding it to a data source, just like the UltraGrid. So use the UltraGridBase.SetDataBinding method, or the UltraGridBase.DataSource and UltraGridBase.DataMember properties.

Be sure to set the UltraDropDownBase.ValueMember property to determine which column in the dropdown is associated with the Value of the UltraCombo.

Optionally, you may also want to set the UltraDropDownBase.DisplayMember property to display more user-friendly text, instead of displaying the value.

Note that the UltraCombo control requires a container (such as a Form or UserControl) in order to function properly. Placing the control on a form (or UserControl) at design-time is sufficient for this, but if the control is created at run-time in code, be sure to add the UltraCombo to the form's (or UserControl's) Controls collection.

See Also