看板 Book11
作者 book11 (不可失憶)
標題 CheckBoxList 複選存值
時間 2011年06月19日 Sun. PM 10:23:36


CheckBoxList 複選存值問題

VB:
view plainprint?
Dim Str As String = ""  
 For i As Integer = 0 To Me.CheckBoxList1.Items.Count - 1  
            Dim a As Boolean = Me.CheckBoxList1.Items(i).Selected  
            If a Then  
                Str As += Me.CheckBoxList1.Items(i).Text & ","  
            End If  
        Next  



C#:
view plainprint?
string Str = "";  
    for (int i = 0; i <= this.CheckBoxList1.Items.Count - 1; i++) {  
        bool a = this.CheckBoxList1.Items(i).Selected;  
        if (a == true) {  
                 
            Str += this.CheckBoxList1.Items(i).Text + ",";  
        }  
    }  

--
※ 作者: book11 時間: 2011-06-19 22:23:36