Re: [.NET] ListBox上 刪除所選取的名單
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章