公开引用的mde的类模块 [英] expose class modules of a referenced mde

查看:79
本文介绍了公开引用的mde的类模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有人的问候,


我在本网站上的最近几个小时的帖子一直在阅读和

各种MS网站有关参考库和课程的信息模块。


系统:Windows 2K运行带有各种标准模块的A2K数据库和

a少数自定义类模块。剥去标准和类

模块并将它们放在一个独立的mdb中,然后将其转换为

一个mde并从另一个mdb引用(稍后,它将是一个mde,但是

我现在只在开发中,所以它仍然是一个mdb)。


问题:全局变量,公共

标准模块的函数和子程序是应该的,但是类模块不是b
。我曾尝试使用Terry Kreft的建议公开它们

这些东西。


方法1:使用公共函数引用类在引用的数据库中的一个

标准模块中。调用如:


公共函数fMyClass()as cMyClass

Dim mc as cMyClass

设置mc =新cMyClass

设置fMyClass = mc

结束功能


方法2:称为不安全方式通过Kreft,但据说可以使用

Lyle Fairfield等:


1.将类保存为.txt或.cls文件。

2.更改属性VB_Exposed到真。

3.将| File ...插入到具有相同名称的新类模块中。


这应该会产生一个外部可创建的类模块允许

调用如:


Dim MyObj为cMyClass

设置MyObj = new cMyClass


MyObj

''....做东西

结束


使用方法编号1让我无处可去。

方法2导致无效使用新关键字错误当代码

在引用数据库中编译时。删除New关键字结果

inVariable not defined。


所有类模块都包装实际对象并赋值(设置)

通过引用表单上的实际对象来获取它们的属性。


我是否误读了这些说明,或者它们对A2K无效?

如何在引用的mde中公开一个类模块,以便在引用mdb的

中使用?

Greetings all,

I''ve been reading for the last couple hours posts on this site and
various MS sites about reference libraries and class modules.

System: Windows 2K running an A2K db with various standard modules and
a handful of custom class modules. Stripped out the standard and class
modules and put them in a stand-alone mdb which was then converted to
an mde and referenced from another mdb (later, it will be an mde, but
i''m only in development now, so it''s still an mdb).

Problem: The global variables, public functions and subroutines of the
standard modules are there as they should be, but the class modules are
not. I''ve tried exposing them using both of Terry Kreft''s suggestions
for such things.

Method 1: Referencing the class with a public function in one of the
standard modules in the referenced db. Call like:

Public Function fMyClass() as cMyClass
Dim mc as cMyClass
Set mc = New cMyClass
Set fMyClass = mc
End Function

Method 2: Called the "unsafe way" by Kreft, but supposedly in use by
Lyle Fairfield, et al.:

1. Save class as .txt or .cls file.
2. Change "Attribute VB_Exposed" to True.
3. Insert|File... into new class module with the same name.

That should result in an externally creatable Class Module and allow
calls like:

Dim MyObj as cMyClass
Set MyObj = new cMyClass

With MyObj
''.... do stuff
End With

Using method number 1 gets me nowhere.
Method 2 results in an "Invalid use of New keyword error" when the code
compiles in the referencing database. Removing the New keyword results
in "Variable not defined".

All of the class modules wrap actual objects and assign (set)
properties for them by referencing actual objects on the forms.

Am I misreading these instructions, or are they not valid for A2K? How
do I expose a class module in a referenced mde for use in the
referencing mdb?

推荐答案

>方法2:称为不安全的方式。由Kreft,但据说由
> Method 2: Called the "unsafe way" by Kreft, but supposedly in use by
Lyle Fairfield等人使用:

1.将类保存为.txt或.cls文件。
2.更改属性VB_Exposed真实。
3.将|文件...插入到具有相同名称的新类模块中。
这应该会产生一个外部可创建的类模块,并允许
调用如下:

Dim MyObj作为cMyClass
设置MyObj = new cMyClass
使用MyObj
''....做东西

结束方法2导致无效使用新关键字错误当
代码在引用数据库中编译时。在未定义的变量中删除New关键字结果

所有类模块都通过引用表单上的实际对象来包装实际对象并为它们分配(设置)
属性。 br />
我误读了这些说明,还是它们对A2K无效?我如何在引用的mde中公开一个类模块,以便在引用mdb中使用?
Lyle Fairfield, et al.:

1. Save class as .txt or .cls file.
2. Change "Attribute VB_Exposed" to True.
3. Insert|File... into new class module with the same name.
That should result in an externally creatable Class Module and allow
calls like:

Dim MyObj as cMyClass
Set MyObj = new cMyClass
With MyObj
''.... do stuff
End With Method 2 results in an "Invalid use of New keyword error" when the
code
compiles in the referencing database. Removing the New keyword results
in "Variable not defined".
All of the class modules wrap actual objects and assign (set)
properties for them by referencing actual objects on the forms.

Am I misreading these instructions, or are they not valid for A2K? How
do I expose a class module in a referenced mde for use in the
referencing mdb?




我也正在使用所谓的 ;不安全"您描述的模式,但我也改变了

导出的clase模块标题中的另一行:


属性VB_Creatable = True

Tyr如果这可能是你的情况。


-

PBsoft di Gabriele Bertolucci
www.pbsoft.it

skype:pbsoftsolution



I too am using the so said "unsafe" mode you described, but I changed also
another line in the header of the exported clase modules:

Attribute VB_Creatable = True

Tyr if this could be your case.

--
PBsoft di Gabriele Bertolucci
www.pbsoft.it
skype: pbsoftsolution

谢谢,我会试一试。更改我的帖子中提到的行

暴露了对象浏览器中的Class对象,但除了声明X类型的变量之外,它没有给我任何

的能力。我仍然不能设置

属性,因为我可以在类本地的数据库中使用或使用新的

关键字。我会尝试你的建议并回复结果。


Thx .... Jamey

Thanks, I''ll give that a shot. Changing the line mentioned in my post
exposes the Class object in the object browser, but doesn''t give me any
ability other than declaring varibles of type X. I still can''t Set
properties as I can in a db where the classes are local or use the New
keyword. I''ll try your suggestion and post back the results.

Thx....Jamey


MyClass.cls文件的标题部分应如下所示: -


VERSION 1.0 CLASS

BEGIN

MultiUse = - 1''正确

结束

属性VB_Name =" cMyClass"

属性VB_GlobalNameSpace = False

属性VB_Creatable = True

属性VB_PredeclaredId = False

属性VB_Exposed = True

注意VB_Exposed = True和VB_Creatable = True行。


BTW;我想我把这种方法称为不安全。曾经和我一样困扰我

多年,我的意思是它没有文档和无证

功能是不可靠的。

-


Terry Kreft

" Jamey Shuemaker" < CA ********* @ yahoo.com>在消息中写道

news:11 ********************** @ i40g2000cwc.googlegr oups.com ...
The header section of your MyClass.cls file should look like this:-

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 ''True
END
Attribute VB_Name = "cMyClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True

Note the VB_Exposed = True and the VB_Creatable = True lines.

BTW; I think I referred to this method as "unsafe" once and that''s dogged me
for years, what I meant was that it was undocumented and undocumented
features cannot be relied upon.

--

Terry Kreft
"Jamey Shuemaker" <ca*********@yahoo.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
所有人的问候,

我一直在阅读本网站最近几个小时的帖子和各种MS网站上有关参考图书馆和课程模块的文章。
<系统:Windows 2K运行带有各种标准模块的A2K数据库和一些自定义类模块。剥离标准和类
模块并将它们放在一个独立的mdb中,然后将其转换为一个mde并从另一个mdb引用(稍后,它将是一个mde,但是
我现在只在开发中,所以它仍然是一个mdb。

问题:
标准模块的全局变量,公共函数和子程序是应该的是的,但课程模块不是。我曾尝试使用Terry Kreft的建议对这些东西进行暴露。

方法1:在其中一个中引用具有公共功能的类
引用数据库中的标准模块。调用如:

公共函数fMyClass()as cMyClass
Dim mc as cMyClass
设置mc =新cMyClass
设置fMyClass = mc
结束函数<方法2:称为不安全的方式由Kreft,但据说由Lyle Fairfield等人使用:

1.将类保存为.txt或.cls文件。
2.更改属性VB_Exposed ;真实。
3.将|文件...插入到具有相同名称的新类模块中。

这应该会产生一个外部可创建的类模块,并允许
调用如下:

Dim MyObj作为cMyClass
设置MyObj = new cMyClass

使用MyObj
''....做的东西
结束

使用方法编号1让我无处可去。
方法2导致无效使用新关键字错误当代码
在引用数据库中编译时。在未定义变量中删除New关键字结果

所有类模块都包含实际对象,并通过引用实际对象来为它们分配(设置)
属性。表格。

我是否误读了这些说明,或者它们对A2K无效?我如何在引用的mde中公开一个类模块,以便在引用mdb中使用?
Greetings all,

I''ve been reading for the last couple hours posts on this site and
various MS sites about reference libraries and class modules.

System: Windows 2K running an A2K db with various standard modules and
a handful of custom class modules. Stripped out the standard and class
modules and put them in a stand-alone mdb which was then converted to
an mde and referenced from another mdb (later, it will be an mde, but
i''m only in development now, so it''s still an mdb).

Problem: The global variables, public functions and subroutines of the
standard modules are there as they should be, but the class modules are
not. I''ve tried exposing them using both of Terry Kreft''s suggestions
for such things.

Method 1: Referencing the class with a public function in one of the
standard modules in the referenced db. Call like:

Public Function fMyClass() as cMyClass
Dim mc as cMyClass
Set mc = New cMyClass
Set fMyClass = mc
End Function

Method 2: Called the "unsafe way" by Kreft, but supposedly in use by
Lyle Fairfield, et al.:

1. Save class as .txt or .cls file.
2. Change "Attribute VB_Exposed" to True.
3. Insert|File... into new class module with the same name.

That should result in an externally creatable Class Module and allow
calls like:

Dim MyObj as cMyClass
Set MyObj = new cMyClass

With MyObj
''.... do stuff
End With

Using method number 1 gets me nowhere.
Method 2 results in an "Invalid use of New keyword error" when the code
compiles in the referencing database. Removing the New keyword results
in "Variable not defined".

All of the class modules wrap actual objects and assign (set)
properties for them by referencing actual objects on the forms.

Am I misreading these instructions, or are they not valid for A2K? How
do I expose a class module in a referenced mde for use in the
referencing mdb?



这篇关于公开引用的mde的类模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆