Databound ListBox Won't Update on Clear?

VagabondSW

Regular
Joined
Feb 19, 2005
Messages
66
I have a ListBox control bound to an ArrayList:

Visual Basic:
  Dim m_expressionFilters As ArrayList
  Dim m_expressionBindingManager As BindingManagerBase
  m_expressionFilters = New ArrayList
  m_expressionBindingManager = BindingContext(m_expressionFilters)
  lstboxFilters.DataSource = m_expressionFilters
When I add an Item to the ArrayList, that change is immediately reflected in
the ListBox:

Visual Basic:
  m_expressionBindingManager.SuspendBinding()
  m_expressionFilters.Add(CurrentFilter)
  m_expressionBindingManager.ResumeBinding()
However, when I call the Clear method of the ArrayList, the changes are not
reflected in the ListBox:

Visual Basic:
  m_expressionBindingManager.SuspendBinding()
  m_expressionFilters.Clear()
  m_expressionBindingManager.ResumeBinding()
At this point, the m_expressionFilters ArrayList has a Count of zero, but
the Items formerly held in the ArrayList are still listed on the form in the
ListBox. I have tried calling the Refresh and Update methods on the
ListBox, but that produced no visible changes at all.

Any help or advice would be greatly appreciated.
 
Back
Top