作者myrabbit (兔)
看板Visual_Basic
标题Re: [.NET] ListBox上 删除所选取的名单
时间Fri May 12 09:54:50 2006
※ 引述《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