Trending News
Promoted
asp.net簡單語法問題
想請問下列的程式碼
有些部份不能理解
可以「每一 行」的意思解釋給我看嗎(最下面三行不用)
例如第一行我就不懂為什麼要設為nothgin了
Label2.Text = Nothing
Dim i As Int16
For i = 0 To CheckBoxList1.Items.Count - 1
If CheckBoxList1.Items(i).Selected Then
Label2.Text &= CheckBoxList1.Items(i).Text & ";"
End If
Next
End Sub
2 Answers
Rating
- 1 decade agoFavorite Answer
Label2.Text = Nothing.
//把Label2設定為沒有任何字串
Dim i As Int16
//定是i是數值
For i = 0 To CheckBoxList1.Items.Count - 1
//i由0到List1清單筆數-1
If CheckBoxList1.Items(i).Selected Then
//如果點選其中一個選項的話
Label2.Text &= CheckBoxList1.Items(i).Text & ";"
//把List1清單上被點選的字串放到Label2上
End If
Next
Source(s): me - ?Lv 71 decade ago
一般應該不會設為Nothing...而是空字串 ""
畢竟.Text是字串....在.net的 物件導向 觀念下(字串也是物件),設為nothing情有可原...但義意上是不一樣的!
Still have questions? Get your answers by asking now.