標題:

有關VB.NET中的取得Listbox項目的文字的問題

發問:

我用Microsoft Visual Basic 2005寫緊一個Program, 但係有d小問題..假設我有個ListBox裡面有:AAABBBCCC呢三個Items, 我想用一個For loop去用呢三個關鍵字用番SQL Select番d野問題黎啦....請問有咩指令可以順住拎呢1至3項既文字?試過Listbox.GetItemText(i)又好似唔得, 陣係比d 1,2,3 d數字我...我想用For loop拎"AAA", "BBB", "CCC", 試左成日都試唔到...非常緊急,... 顯示更多 我用Microsoft Visual Basic 2005寫緊一個Program, 但係有d小問題.. 假設我有個ListBox裡面有: AAA BBB CCC 呢三個Items, 我想用一個For loop去用呢三個關鍵字用番SQL Select番d野 問題黎啦.... 請問有咩指令可以順住拎呢1至3項既文字? 試過Listbox.GetItemText(i)又好似唔得, 陣係比d 1,2,3 d數字我... 我想用For loop拎"AAA", "BBB", "CCC", 試左成日都試唔到... 非常緊急, 希望有人幫忙<(_ _)>

最佳解答:

If you want to list the items in a multiline textbox2, embed the following code into a button_click method, you will get AAA, BBB, CCC on separate line. Of course, you can do other things with it the way you like. Note that the item indices are zero-based. Dim crlf As String crlf = Chr(13) Chr(10) Dim i As Integer For i = 1 To ListBox1.Items.Count TextBox2.Text = TextBox2.Text ListBox1.Items.Item(i - 1) crlf Next 2008-05-25 21:10:51 補充: Errata: the + sign had been stripped off by Yahoo TextBox2.Text = TextBox2.Text + ListBox1.Items.Item(i - 1) crlf 2008-05-25 21:12:06 補充: Errata prise 2: TextBox2.Text = TextBox2.Text + ListBox1.Items.Item(i - 1) + crlf

免費註冊體驗

 

此文章來自奇摩知識+如有不便請留言告知

其他解答:
arrow
arrow

    zpj955v 發表在 痞客邦 留言(0) 人氣()