473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem loading values from class library

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

--
Dale Preston
MCAD C#
MCSE, MCDBA
Nov 18 '06 #1
1 1619
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
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Dale" wrote:
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

--
Dale Preston
MCAD C#
MCSE, MCDBA
Nov 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Outshined | last post by:
I have a class library where just about every class uses its static initializer to register with a central registry object in the same assembly. I am hoping for some sort of Assembly.Load event...
17
by: Dave | last post by:
Hi I'm making a 3D Engine which consists of the class C3DEngine. Part of this engine is a file loader, a class called CMeshLoader. I have made an instance of CMeshLoader in C3DEngine, ie...
3
by: KeithO | last post by:
I am having problems calling dynamic_cast<> on a pointer returned by a dynamically loaded library. The problem seems to be related to the fact that I dynamically load the library because if I link...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
3
by: markeboy | last post by:
I am wanting to control when a page is loaded using a separate class to manage when and how it should be loade My current implementation needs to set a property of the page programatically...
7
by: George Copeland | last post by:
This is a request for assistance analyzing a problem we are experiencing in our VB6 development environment. All our code is developed in VB6, and our persistance layer is SQL Server. We are...
3
by: f1racing24 | last post by:
I am trying to compile this class in the command-line and this error comes up 'Start -> C:\Inetpub\wwwroot\DCReview_Brinkster\code>vbc /t:library /verbose...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.