How to use ListBox

B

Boni

Dear all,
I have a very simple question.
I have a listbox with datasource, where DataSource is an arraylist.
I.e. MyListbox.DataSource=MyDataSource.

Now I add/remove something to DataSource, i.e.
MyDataSource.Add("XXX")/MyDatasource.Remove("YYY")
I would expect that this XXX is shown in a Listbox/YYY deleted from a
listbox, but it is not the case.
How do force a ListBox to reread DataSource
Thanks ,
Boni
 
H

Herfried K. Wagner [MVP]

Boni said:
How do force a ListBox to reread DataSource

\\\
Private m_Data As New ArrayList

Private Sub Form1_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Load
m_Data.Add("Hello")
Me.ListBox1.DataSource = m_Data
End Sub

Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
m_Data.Add("Bla")
DirectCast( _
Me.ListBox1.BindingContext(Me.ListBox1.DataSource), _
CurrencyManager _
).Refresh()
End Sub
///
 
B

Boni

Dear Herfried,
What is CurrencyManager ? Is it arraylist?I can'find any refresh member in
listbox
 
H

Herfried K. Wagner [MVP]

Boni said:
What is CurrencyManager ? Is it arraylist?I can'find any refresh member in
listbox

'CurrencyManager' is a class which is part of the .NET Framework.
 

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

Similar Threads


Top