PowerTools InputMan for ASP.NET 8.0J
SelectedItem プロパティ (GcListBox)
使用例 

現在選択されている項目を取得または設定します。
構文
Public Property SelectedItem As ListItem
public ListItem SelectedItem {get; set;}

プロパティ値

既定値:Null
解説
SelectedItemプロパティは、リストボックス内で現在選択されている項目(ListItemオブジェクト) を取得します。
使用例
次のサンプルコードは、選択項目が変更されたときにその内容を取得します。
Private Sub GcListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GcListBox1.SelectedIndexChanged
    If GcListBox1.SelectedItem = Nothing Then Return
    Label1.Text = GcListBox1.SelectedItem.Text
End Sub
private void GcListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
    if (GcListBox1.SelectedItem == null) return;
    label1.Text = GcListBox1.SelectedItem.Text;
}
参照

GcListBox クラス
GcListBox メンバ

 

 


© 2005-2015 GrapeCity inc. All rights reserved.