List.ItemCommand イベントとは? わかりやすく解説

List.ItemCommand イベント

List コントロールに関連付けられているコマンドをユーザーが選択すると発生します。

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Public Event ItemCommand As
 ListCommandEventHandler
Dim instance As List
Dim handler As ListCommandEventHandler

AddHandler instance.ItemCommand, handler
public event ListCommandEventHandler ItemCommand
public:
event ListCommandEventHandler^ ItemCommand {
    void add (ListCommandEventHandler^ value);
    void remove (ListCommandEventHandler^ value);
}
/** @event */
public void add_ItemCommand (ListCommandEventHandler
 value)

/** @event */
public void remove_ItemCommand (ListCommandEventHandler
 value)
JScript では、イベントは使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

ItemCommand イベントを使用して、リスト内の項目のステータスを変更し、ステータスの合計を再計算するメソッドを呼び出す方法を次のコード例に示します。このコード例は、List の概要で取り上げているコード例の一部です。

Private Sub Status_ItemCommand(ByVal
 sender As Object, _
    ByVal e As ListCommandEventArgs)

    Const spec As String
 = "You now have {0} tasks done, {1} " & _
        "tasks scheduled, and {2} tasks pending."

    ' Move selection to next status toward 'done'
    Select Case e.ListItem.Value
        Case "scheduled"
            schedCount -= 1
            pendCount += 1
            e.ListItem.Value = "pending"
        Case "pending"
            pendCount -= 1
            doneCount += 1
            e.ListItem.Value = "done"
            
    End Select

    ' Show the status of the current task
    Label1.Text = e.ListItem.Text & " is " &
 _
        e.ListItem.Value

    ' Show current selection counts
    Label2.Text = String.Format(spec, doneCount, _
        schedCount, pendCount)
End Sub
Private Sub Status_ItemCommand(ByVal sender As Object, _
    ByVal e As ListCommandEventArgs)

    Const spec As String = "You now have {0} tasks done, {1} " & _
        "tasks scheduled, and {2} tasks pending."

    ' Move selection to next status toward 'done'
    Select Case e.ListItem.Value
        Case "scheduled"
            schedCount -= 1
            pendCount += 1
            e.ListItem.Value = "pending"
        Case "pending"
            pendCount -= 1
            doneCount += 1
            e.ListItem.Value = "done"
            
    End Select

    ' Show the status of the current task
    Label1.Text = e.ListItem.Text & " is " & _
        e.ListItem.Value

    ' Show current selection counts
    Label2.Text = String.Format(spec, doneCount, _
        schedCount, pendCount)
End Sub
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
List クラス
List メンバ
System.Web.UI.MobileControls 名前空間
Command クラス
CommandEventArgs
ItemCommand
ObjectListCommandEventArgs
OnItemCommand
その他の技術情報
List コントロールの概要



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

List.ItemCommand イベントのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



List.ItemCommand イベントのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS