Re: [.NET] ListBox上 刪除所選取的名單

看板Visual_Basic作者 (兔)時間19年前 (2006/05/12 09:51), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《datagram (...)》之銘言: : 我有一個 ListBox 上面可以新增許多名單 : 又另設了一個Button 可以刪除在ListBox上 所選取的某名單 : 這個 Button裡面要怎麼寫指令 試了好久還是不成功 = = : 應該是 ListBox.*** = *** 的嗎? : 之前講的VB文章好像不適用 : 感謝... Me.ListBox1.Items.Remove(Me.ListBox1.SelectedItem) 'or Me.ListBox1.Items.RemoveAt(Me.ListBox1.SelectedIndex) ListBox1.SelectedItem → 抓到選取的Item ListBox1.Items.Remove → 傳入選取的item,刪除item ListBox1.SelectedIndex → 抓到選取的Item 位在listbox中的打一個位置 Me.ListBox1.Items.RemoveAt → 依照選取的item位置,刪除item -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.184.51.8
文章代碼(AID): #14O-eF4C (Visual_Basic)
文章代碼(AID): #14O-eF4C (Visual_Basic)