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

The value that has been selected from the dropdown list.

Syntax

Visual Basic (Declaration) 
Public Property Value As Object
C# 
public object Value {get; set;}

Example

Following code prints out the values of Value and Text properties.

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

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click

      ' Value property returns the value of the ValueMember field in the currently 
      ' selected item in the UltraCombo.

      If Me.ultraCombo1.Value Is DBNull.Value Then
          ' If Value is DBNull, then no item is selected.
          Debug.WriteLine("No item has been selected.")
          Debug.WriteLine("Text = " & Me.ultraCombo1.Text)
      Else
          ' Print out the value and the text.
          Debug.WriteLine("Value = " & Me.ultraCombo1.Value.ToString())
          Debug.WriteLine("Text = " & Me.ultraCombo1.Text)
      End If

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

private void button1_Click(object sender, System.EventArgs e)
{
	
	// Value property returns the value of the ValueMember field in the currently 
	// selected item in the UltraCombo.

	if ( this.ultraCombo1.Value == DBNull.Value )
	{
		// If Value is DBNull, then no item is selected.
		Debug.WriteLine( "No item has been selected." );
		Debug.WriteLine( "Text = " + this.ultraCombo1.Text );
	}
	else
	{
		// Print out the value and the text.
		Debug.WriteLine( "Value = " + this.ultraCombo1.Value.ToString( ) );
		Debug.WriteLine( "Text = " + this.ultraCombo1.Text );
	}

}

Remarks

When the user selects an item from, the value is set based on the UltraDropDownBase.ValueMemberResolved property.

When the user enters text into the combo, the list is searched based on the UltraDropDownBase.DisplayMemberResolved property. If a matching string is found in the UltraDropDownBase.DisplayMemberResolved column, the Value of the combo is the value of the UltraDropDownBase.ValueMemberResolved column in the same row. If the text entered in the combo does not match any item on the list, then the value will return the displayed Text.

See Also