DataRepeater.CurrentItem プロパティ
DataRepeater コントロールの現在の DataRepeaterItem を取得します。
名前空間: Microsoft.VisualBasic.PowerPacks
アセンブリ: Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)
構文
'宣言
<BrowsableAttribute(False)> _
Public ReadOnly Property CurrentItem As DataRepeaterItem
[BrowsableAttribute(false)]
public DataRepeaterItem CurrentItem { get; }
[BrowsableAttribute(false)]
public:
property DataRepeaterItem^ CurrentItem {
DataRepeaterItem^ get ();
}
[<BrowsableAttribute(false)>]
member CurrentItem : DataRepeaterItem
function get CurrentItem () : DataRepeaterItem
プロパティ値
型 : Microsoft.VisualBasic.PowerPacks.DataRepeaterItem
現在選択されているオブジェクト。
解説
実行時に現在選択されている DataRepeaterItem のコントロールやデータを変更するために CurrentItem のプロパティを使用します。
例
項目を選択すると、次の例に変更を加えるときに CurrentItem のプロパティを使用する方法を示します。DataRepeater1、UnitsInStockTextBox と LowStockWarningLabel という名前の Label という名前のバインド TextBox という名前のバインド DataRepeater を含むフォームはです。
Private Sub DataRepeater1_CurrentItemIndexChanged(
) Handles DataRepeater1.CurrentItemIndexChanged
' Exit if the control is first loading.
If DataRepeater1.CurrentItem Is Nothing Then Exit Sub
' Check for zero or negative quantity.
If CDbl(
DataRepeater1.CurrentItem.Controls("UnitsInStockTextBox").Text
) < 1 Then
' Display a the warning label on the form.
Me.LowStockWarningLabel.Visible = True
Else
Me.LowStockWarningLabel.Visible = False
End If
End Sub
private void dataRepeater1_CurrentItemIndexChanged(object sender, System.EventArgs e)
{
// Exit if the control is first loading.
if (dataRepeater1.CurrentItem == null) { return; }
// Check for zero quantity.
if (dataRepeater1.CurrentItem.Controls["unitsInStockTextBox"].Text == "0")
// Display a the warning label on the form.
{
this.lowStockWarningLabel.Visible = true;
}
else
{
this.lowStockWarningLabel.Visible = false;
}
}
.NET Framework セキュリティ
- 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
関連項目
Microsoft.VisualBasic.PowerPacks 名前空間