バージョン

FindString(String,Int32) メソッド

FindString メソッド
シンタックス
'宣言
 
Public Overloads Overridable Function FindString( _
   ByVal s As String, _
   ByVal startIndex As Integer _
) As Integer
public virtual int FindString( 
   string s,
   int startIndex
)

パラメータ

s
検索する文字列
startIndex
最初の検索対象項目のインデックス。

戻り値の型

指定した文字列と部分的に一致する最初の項目のインデックス。
使用例
Private Sub SelectString(ByVal str As String)

' Attempt to find passed in string.
     Dim index As Integer = Me.UltraComboEditor1.FindString(str)

     If index <> -1 Then
		' String has been found, highlight it. First restore appearance on non
		' highlighted items

         Dim i As Integer
         For i = 0 To Me.UltraComboEditor1.Items.Count - 1
             If i <> index Then
                 Me.UltraComboEditor1.Items(i).Appearance.FontData.Reset()
                 Me.UltraComboEditor1.Items(i).Appearance.ResetBackColor()
             End If
         Next i

		' Highlight the found item in the list
         Dim item As Infragistics.Win.ValueListItem = Me.UltraComboEditor1.Items(index)

         item.Appearance.BackColor = Color.Yellow
         item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True

		' Set the selected item
         Me.UltraComboEditor1.SelectedItem = item
     End If
	
 End Sub
private void SelectString(string str)
{

	// Attempt to find passed in string.
	int index = this.ultraComboEditor1.FindString(str);

	if (index != -1)
	{

		// String has been found, highlight it. First restore appearance on non
		// highlighted items
		for(int i = 0; i < this.ultraComboEditor1.Items.Count ; i++)
		{
			if (i != index)
			{
				this.ultraComboEditor1.Items[i].Appearance.FontData.Reset();
				this.ultraComboEditor1.Items[i].Appearance.ResetBackColor();
			}
		}

		// Highlight the found item in the list
		Infragistics.Win.ValueListItem item = this.ultraComboEditor1.Items[index] as Infragistics.Win.ValueListItem;

		item.Appearance.BackColor = Color.Yellow;
		item.Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True ;

		// Set the selected item
		this.ultraComboEditor1.SelectedItem = item;
	}

}
参照