How do I use a method whose parameter is a _T object?

Posted by Admin on 03-Nov-2008 01:13

Hello, guys.

I hope this is the right forum to place this question. So far, I didn't find any posts related to what I am about to say.

I have to use a method (of a .NET 3.5, WPF object) with the following Visual Basic declaration:

Public Sub Add( ByVal item As T _).

In fact, this method adds an object to a collection, ...Collection.

When compiling, I get the following error on the line using the method:

"Could not locate element 'Add' in class ...".

The only culprit I can think of is the use of the template object. Am I right? Is there an workaround for this?

I hope I will get an answer, because I really need this method.

Thanks in advance.

All Replies

Posted by Admin on 03-Nov-2008 03:23

In which environment are you trying this out?

Are you using Com-Interop to access .NET functionality from an ABL client? Com-Interop does not support generic types (that how a Collection must be defined as a collection of a specific type (T). You need The Add method expects an object of that type (not the type itself). Maybe posting some lines of code may help to understand your problem.

Mike

Posted by Admin on 03-Nov-2008 06:42

Thanks, Mike, for your prompt response.

I have integrated a xamCarouselPanel object, a WPF control from Infragistics, with the help of a ElementHost object (Windows object which allows using a WPF object in Windows Forms). (Of course, I can't use the Visual Designer, but, hopefully, OpenEdge will support WPF in the future.)

These are the code lines relevant to the issue.

DEFINE PRIVATE VARIABLE elementHost1 AS System.Windows.Forms.Integration.ElementHost NO-UNDO.

define private variable xamCarouselPanel1 as Infragistics.Windows.Controls.XamCarouselPanel no-undo.

define variable ses as ScalingEffectStop no-undo.

xamCarouselPanel1:ViewSettings:ScalingEffectStops:Add(ses). /This is the line with the error!!!/

elementHost1:Child = xamCarouselPanel1.

This code snippet is taken from a *.cls file, of an ABL form.

The full documentation for the XamCarouselPanel class can be found on the Infragistics site, at this address: http://help.infragistics.com/NetAdvantage/WPF/2008.1/CLR3.x/. From the tree in the left, choose 'Developer's guide/Controls/xamCarouselPanel'...

...

So, can I use the generic type in this case?

Thanks.

Posted by Admin on 03-Nov-2008 06:53

Hi Daniel, until the release of 10.2A you should post this kind of questions to the beta forum.

Sorry...

This thread is closed