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 / Languages / C# / November 2006

Tip: Looking for answers? Try searching our database.

Problem loading values from class library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dale - 18 Nov 2006 20:53 GMT
I have a user control on a Windows Form that, in its Load event handler,
calls a method from a class library to initialize an array of objects that
are then used to populate a ComboBox.

When I run the app, the method runs just fine.  The class library returns
the array of objects and the ComboBox is loaded.

The problem I am having is when I try to open the form that contains the
user control in the designer.  Instead of the form, I get the ugly pink and
white designer error page that you've probably seen before.  The error it
shows says:

    Method not found: 'MyLib.MyObj[] MyLib.ClassInMyLib.GetList()'.

I have tried making the whole thing static - there's no reason at all to
instantiate the class to get this list - but that didn't work.  Next, I tried
non-static where I had to create an instance of the class in my user control.
I get the same error.  I have tried calling the method directly from the
assignment to the ComboBox and I have tried filling a local array from the
method and assigning that to the ComboBox.  

No matter what I have tried, the error from the designer is exactly the same
- not a single character in the message is different.  It reads right through
all my attempts at obfuscation and rejects the underlying method.

Oh, and I tried returning the array as a property named ObjectList.  That
changed the error message only in that it now said:

    Method not found: 'MyLib.MyObj[] MyLib.ClassInMyLib.get_ObjectList'.

The designer sees right past the property and rejects the underlying getter.

Like I said, I can compile this program and run it and it all works as
expected.  I just can't work with it in the designer any more.

Any help at all would be greatly appreciated.

Dale

Signature

Dale Preston
MCAD C#
MCSE, MCDBA

Dale - 18 Nov 2006 21:34 GMT
Well, I got it working.  I moved the static class to my Windows Forms project
and changed all the references to the new location and still the designer
complained about the method not being available in the class library!  And I
wasn't even referencing the class library anymore!

I just wasted 4 hours chasing a problem because the designer wasn't keeping
up with any of the code changes I was making even with compiling and
re-compiling both the class library and the Windows Forms project.  

I finally put it all back like it was supposed to be, including the class
library, and then closed Visual Studio and re-opened the project and now it
works. GRRRRRRRRRRRRRRR.

Dale
Signature

Dale Preston
MCAD C#
MCSE, MCDBA

> I have a user control on a Windows Form that, in its Load event handler,
> calls a method from a class library to initialize an array of objects that
[quoted text clipped - 34 lines]
>
> Dale

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.