Using Custom Class from Script Library

In a script library (“MyLibrary”) I’ve created a custom class (“MyClass”). I’m trying to use the library within a form. In the forms Options section i’ve added:

Use “MyLibrary”

On a button Click, I have:

Dim mc As MyClass

I get the error “Class or type name not found: MYCLASS”.

Any help would be greatly appreciated! Thanks in advance

Subject: Using Custom Class from Script Library

Jared,

In the script Library name do you have the quotes and brackets??

So is the library name really (“MyLibrary”) or is it MyLibrary?

Same question for the class?

Shawn

Subject: RE: Using Custom Class from Script Library

No quotes or brackets, just letters.

Script Library: MyLibrary

User Defined Class: MyClass

Subject: RE: Using Custom Class from Script Library

Export of the files below. Hopefully this helps.

form-------------------------------------

'(Globals):

Option Public

'Create_File:

Use “MyLibrary”

Sub Click(Source As Button)

Dim fw As New MyClass

End Sub

script library-------------------------------------

'MyLibrary:

Option Public

Option Explicit

Public Class MyClass

End Class

Subject: RE: Using Custom Class from Script Library

Closed Notes and Notes Designer, everything is working perfectly. No errors. No problems. So my code was fine the whole time.

So I hate lotus notes. Its the worst development platform ever!

I just wasted an hour or more of my time - Thank you IBM.

Subject: RE: Using Custom Class from Script Library

Sometimes when you implment (use) your own custom data types you need to recompile your LS code. Do that by choosing Tools > Recompile All LotusScript. The other way to accomplish that is close and open the environment so it will reload the new data type, as you did. This is no different than any other OO language when you add a new data type.

Shawn

Subject: RE: Using Custom Class from Script Library

Hi,

Custom class in LotusScript: A few more questions
This document provides a list of links to both external and internal developerWorks Lotus resources that will help you better understand user-defined (that is, custom) classes in LotusScript. This FAQ was created by Andrea Span.

JYR

Subject: RE: Using Custom Class from Script Library

Your best bet would have been to consult help - would have saved you some frustration.