DataRepeater.CurrentItemIndex プロパティ
取得または設定の現在のDataRepeaterItemで、DataRepeaterコントロールです。
名前空間: Microsoft.VisualBasic.PowerPacks
アセンブリ: Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)
構文
'宣言
<BrowsableAttribute(False)> _
Public Property CurrentItemIndex As Integer
[BrowsableAttribute(false)]
public int CurrentItemIndex { get; set; }
[BrowsableAttribute(false)]
public:
property int CurrentItemIndex {
int get ();
void set (int value);
}
[<BrowsableAttribute(false)>]
member CurrentItemIndex : int with get, set
function get CurrentItemIndex () : int
function set CurrentItemIndex (value : int)
プロパティ値
型 : Int32
現在の DataRepeaterItem のインデックス。
解説
このプロパティを取得または変更のインデックスを使用して、CurrentItemで、DataRepeaterコントロールです。 設定、CurrentItemIndexプロパティのスクロール、DataRepeaterItemを持つビューには、同等のインデックス。
注意
DataRepeaterItemが最小スクロールの戦略を使用してビューに完全にスクロールされます。一番上を持つ項目を配置する、 DataRepeater、呼び出す、ScrollItemIntoViewメソッドを指定するtrueのAlignWithTopパラメーター。
例
次の例で使用する方法、CurrentItemIndex内のアイテムにフォーカスを設定するプロパティ、DataRepeater検索の結果に応じて、コントロールです。 あることを前提としています、DataRepeaterという名前のコントロールDataRepeater1、TextBoxという名前SearchTextBox、およびButtonという名前のSearchButtonをDataRepeaterは Northwind データベースの Products テーブルのデータ ソースにバインドします。
Private Sub SearchButton_Click() Handles SearchButton.Click
Dim foundIndex As Integer
Dim searchString As String
searchString = SearchTextBox.Text
foundIndex = ProductsBindingSource.Find("ProductID",
searchString)
If foundIndex > -1 Then
DataRepeater1.CurrentItemIndex = foundIndex
Else
MsgBox("Item " & searchString & " not found.")
End If
End Sub
private void searchButton_Click(System.Object sender, System.EventArgs e)
{
int foundIndex;
string searchString;
searchString = searchTextBox.Text;
foundIndex = productsBindingSource.Find("ProductID", searchString);
if (foundIndex > -1)
{
dataRepeater1.CurrentItemIndex = foundIndex;
}
else
{
MessageBox.Show("Item " + searchString + " not found.");
}
}
.NET Framework セキュリティ
- 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
関連項目
Microsoft.VisualBasic.PowerPacks 名前空間