更新 : 2007 年 11 月
削除される項目のインデックスを取得します。
名前空間 : Microsoft.VisualBasic.PowerPacks
アセンブリ : Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)
構文
'宣言
Public ReadOnly Property ItemIndex As Integer
'使用
Dim instance As DataRepeaterAddRemoveItemsCancelEventArgs
Dim value As Integer
value = instance.ItemIndex
public int ItemIndex { get; }
public:
property int ItemIndex {
int get ();
}
public function get ItemIndex () : int
プロパティ値
型 : System.Int32
項目のインデックス。
解説
DataRepeater コントロールから DataRepeaterItem を削除するように要求が行われると、DeletingItems イベントおよび UserDeletingItems イベントが発生します。
DataRepeaterAddRemoveItemsCancelEventArgs の cancel パラメータを True に設定することで、削除をオーバーライドできます。
例
DeletingItems イベント ハンドラで削除をキャンセルする方法を次の例に示します。
Private Sub DataRepeater1_DeletingItems(ByVal sender As Object, _
ByVal e As _
Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsCancelEventArgs) _
Handles DataRepeater1.DeletingItems
' Check whether the user is a supervisor.
If My.User.IsInRole("Supervisor") = False Then
' Cancel the deletion and display a message.
e.Cancel = True
MsgBox("You are not authorized to delete.")
End If
End Sub
private void DataRepeater1_DeletingItems(object sender,
Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsCancelEventArgs e)
{
// Check whether the user is a supervisor.
ClientRolePrincipal rolePrincipal =
System.Threading.Thread.CurrentPrincipal
as ClientRolePrincipal;
if (rolePrincipal.IsInRole("supervisor") == false)
{
e.Cancel = true;
MessageBox.Show("You are not authorized to delete.");
}
}
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
参照
DataRepeaterAddRemoveItemsCancelEventArgs クラス
DataRepeaterAddRemoveItemsCancelEventArgs メンバ
Microsoft.VisualBasic.PowerPacks 名前空間