The DisplayMember determines which column in the dropdown is used for display purposes. If this property is not set, the ValueMember column will be used. To determine the column that is being used as the DisplayMember, you can use the DisplayMemberResolved property.
For example, if you have a column in an UltraGrid control where the user can drop down a list and select a customer, you would use an UltraDropDown control and bind it to a table of customers. The customer table likely has a primary key to uniquely identify customers.
This customer ID field would be used as the ValueMember of the UltraDropDown. But this ID value would not be very useful to the users of the application. So you would set the DisplayMember to the field on the list that contains the customer's name. The grid cell would store the ID (probably in an integer or other numeric-type field), but the display would show the user-friendly customer name.
The UltraCombo control works the same way, except that it has it's own edit portion, instead of using a grid cell. The Value is determined by the ValueMember and the display, as well as the Text property is determined by the DisplayMember.
DisplayMember should only be set when you want to translate data values into more user-friendly display text. If you want the value stored and the value displayed on-screen to be the same, there is no need to set DisplayMember. Setting ValueMember is sufficient.
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
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; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2