Problem loading values from class library

G

Guest

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
 
G

Guest

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
 

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