problem when changing visibility of UserControl (VB.NET Windows Fo

G

Guest

Hi all,

..NET Framework 1.1 / Windows Forms - VB.NET

I have a wizard form and a user control with 2 listboxes on it (plus other
user controls for multiple dates and string values).

At runtime I create a new panel, then I instantiate the user control, pass
in an arraylist as the data source for the left-hand listbox, add the
usercontrol to the controls collection of the panel, and add the panel to the
form.

It all works fine, the arraylist is displayed in the left listbox, events
raised when the user clicks the button to add an item from the list on the
left to the list on the right... plus the panel hides itself ok to show
another panel with a different control when the user clicks Next.

The problem comes when I want to show again the Panel with the listbox
usercontrol on it after the user clicks 'Previous'.

An exception is thrown (cannot change the Items collection when the
DatSource property is set).

thing is, in the Previous method, there is nothing that would try to affect
the Items collection, so where is the error coming from?

thanks for any help

Philip
 
G

Guest

it's ok, the workaround is obviously to set the datsource of the listbox to
nothing before showing it...then set it to it's original source again...

very awkward...
 

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