Question about Listbox

G

Guest

See the code below,why my listbox can't refresh after my do the RemoveAt attribute in the event of Button1_Click
I have used listbox1.refresh() and listbox1.update() ,but they didn't work
any ideas,Thank you for your hel

Private A As New ArrayLis

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
Dim i As Intege
For i = 0 To
A.Add(i * 100
Nex
ListBox1.DataSource =
End Su

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Dim i As Intege
i = ListBox1.SelectedInde
A.RemoveAt(i
ListBox1.Update(
ListBox1.Refresh(

End Su
 
A

Armin Zingler

Menu Chen said:
See the code below,why my listbox can't refresh after my do the
RemoveAt attribute in the event of Button1_Click. I have used
listbox1.refresh() and listbox1.update() ,but they didn't work. any
ideas,Thank you for your help


Private A As New ArrayList

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
For i = 0 To 4
A.Add(i * 100)
Next
ListBox1.DataSource = A
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim i As Integer
i = ListBox1.SelectedIndex
A.RemoveAt(i)
ListBox1.Update()
ListBox1.Refresh()

End Sub

In a bound control, the control displays the data from the datasource it is
bound to. You did not remove an item from the Arraylist, consequently the
Listbox still displays all items.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
G

Guest

thanx for your help,but I have used the a.Removeat(i) to remove the item from the arraylist in the code
 
A

Armin Zingler

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top