Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Philip - 23 Feb 2007 13:50 GMT
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
Philip - 23 Feb 2007 14:09 GMT
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...

> Hi all,
>
[quoted text clipped - 25 lines]
>
> Philip

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.