473,387 Members | 1,493 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,387 software developers and data experts.

Class in library, no intellisense ?

Hi,
I am just 'playing' a bit with classes these days. I would like to use a few classes in my
codelibrary. (mde)
I read (and noticed) that you can't use a class directly when the class is referenced and
is not present in the database from where the class is used.
So I Googled a lot on this and found 2 solutions. 1 safe way (documented) and 1 unsafe
(undocumented) way.
The called 'Safe way' is to create a public function in the library to return an instance
of the class.
So I have a class clsMyClass and use a public function like:
Public fclsMyClass () as clsMyClass
set fclsMyClass = New clsMyClass
end function
I reference the codelibrary and in a standard forms_module I use:
Dim mc as Object
Set mc=fclsMyClass
'Do stuff ...
set mc = Nothing
The code works, the properties are there BUT intellisense does NOT work ??
Am I doing something wrong here?

The unsafe way is changing an attibute (VB_Exposed) by exporting/importing.
I also tried the unsafe way (maybe the wrong way ?), and suddenly I had a lot of 'unknown
errors' when opening the vb-project.
BTW, I am using A2k.

Any ideas?
Thanks
Arno R

Nov 13 '05 #1
6 2635
"Arno R" <ar****************@tiscali.nl> wrote in message
news:42**********************@dreader2.news.tiscal i.nl...
....
I reference the codelibrary and in a standard forms_module I use:
Dim mc as Object
Set mc=fclsMyClass
'Do stuff ...
set mc = Nothing
The code works, the properties are there BUT intellisense does NOT work ??


For Intellisense to work, you might try declaring "mc" more specifically as:

Dim mc as clsMyClass
Set mc=fclsMyClass

- Steve
Nov 13 '05 #2
On Thu, 3 Mar 2005 20:17:57 +0100, "Arno R"
<ar****************@tiscali.nl> wrote:

That's by design.
Put yourself in Access' position. Someone declares dim mc as object.
You have no idea what this guy wants, so you give him as little as
possible. You chalk it up as "late binding", and hope for the best.
Now he says set mc=fclsMyClass. You have some options. He may have
made a wrong assignment, like intOne = strTwo. Anyway, you do your
best to provide type coercion, but you still have no clue what the
detailed type of mc might be.
Stephen is right. Give Access what it needs to unambiguously know what
type mc is. Use early binding.

-Tom.
Hi,
I am just 'playing' a bit with classes these days. I would like to use a few classes in my
codelibrary. (mde)
I read (and noticed) that you can't use a class directly when the class is referenced and
is not present in the database from where the class is used.
So I Googled a lot on this and found 2 solutions. 1 safe way (documented) and 1 unsafe
(undocumented) way.
The called 'Safe way' is to create a public function in the library to return an instance
of the class.
So I have a class clsMyClass and use a public function like:
Public fclsMyClass () as clsMyClass
set fclsMyClass = New clsMyClass
end function
I reference the codelibrary and in a standard forms_module I use:
Dim mc as Object
Set mc=fclsMyClass
'Do stuff ...
set mc = Nothing
The code works, the properties are there BUT intellisense does NOT work ??
Am I doing something wrong here?

The unsafe way is changing an attibute (VB_Exposed) by exporting/importing.
I also tried the unsafe way (maybe the wrong way ?), and suddenly I had a lot of 'unknown
errors' when opening the vb-project.
BTW, I am using A2k.

Any ideas?
Thanks
Arno R


Nov 13 '05 #3
Thanks, but if I do as you tell me Access protests: "Undefined Object"
The class is in a codelibrary as I wrote.
So I guess I just can't use Intellisense here ...

Arno R

"Stephen K. Young" <s k y @ stanleyassociates . com> schreef in bericht
news:38*************@individual.net...
"Arno R" <ar****************@tiscali.nl> wrote in message
news:42**********************@dreader2.news.tiscal i.nl...
...
I reference the codelibrary and in a standard forms_module I use:
Dim mc as Object
Set mc=fclsMyClass
'Do stuff ...
set mc = Nothing
The code works, the properties are there BUT intellisense does NOT work ??


For Intellisense to work, you might try declaring "mc" more specifically as:

Dim mc as clsMyClass
Set mc=fclsMyClass

- Steve

Nov 13 '05 #4
Thanks Tom, but if I do as Stephen tells me Access protests: "Undefined Object"
The class is in a codelibrary as I wrote.
==>> The main issue here is that I can't use early binding.

This just means that when one places class-code in a library one can't use Intellisense.
Never have read that before, but this is just the way it is I guess ...

I will try the undocumented way a bit more and will post back then.

Arno R
"Tom van Stiphout" <no*************@cox.net> schreef in bericht
news:ml********************************@4ax.com...
Stephen is right. Give Access what it needs to unambiguously know what
type mc is. Use early binding.

-Tom.

Nov 13 '05 #5
In order to use early binding you need a reference to the library which
contains the object you are trying to bind to.

Therefore in order to use early binding in this case you would have to use
the export the class and change the VB attribute method.

Although you refere to this as the "unsafe" methdo, this isn't really the
case it really should be described as the undocumented method. Just because
it's undocumented does not mean it's unsafe.

In summary; you can export the class, change the attribute and reimport the
class, you then have the choice of using early binding or late binding, with
early binding you will get intellisense halp.

Alternatively you can use a function to return an instance of your class, in
this case you are restricted to using late binding and therefore cannot use
intellisense.
--
Terry Kreft
MVP Microsoft Access
"Arno R" <ar****************@tiscali.nl> wrote in message
news:42**********************@dreader2.news.tiscal i.nl...
Thanks, but if I do as you tell me Access protests: "Undefined Object"
The class is in a codelibrary as I wrote.
So I guess I just can't use Intellisense here ...

Arno R

"Stephen K. Young" <s k y @ stanleyassociates . com> schreef in bericht
news:38*************@individual.net...
"Arno R" <ar****************@tiscali.nl> wrote in message
news:42**********************@dreader2.news.tiscal i.nl...
...
I reference the codelibrary and in a standard forms_module I use:
Dim mc as Object
Set mc=fclsMyClass
'Do stuff ...
set mc = Nothing
The code works, the properties are there BUT intellisense does NOT work
??
For Intellisense to work, you might try declaring "mc" more specifically as:
Dim mc as clsMyClass
Set mc=fclsMyClass

- Steve


Nov 13 '05 #6
Hi Terry, thanks for your reply,

"Terry Kreft" <te*********@mps.co.uk> schreef in bericht
news:Ov********************@karoo.co.uk...
Although you refere to this as the "unsafe" methdo, this isn't really the
case it really should be described as the undocumented method. Just because
it's undocumented does not mean it's unsafe.


Funny, but it is is actually *you* who called this the 'unsafe way' but it is a while
ago... (1999) you must have changed your mind about this ...
It was you I was 'quoting' in my first post on this:
http://groups.google.nl/groups?q=lib...s.co.uk&rnum=2

I wil try the undocumented (hopefully safe) way ... ;-)

Arno R


Nov 13 '05 #7

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

Similar topics

0
by: Ed. | last post by:
I created a class library using VB.NET (2k3). The library (dll) has two classes within it. It compiled successfully with no errors. I then created a win-app to test the classes within the...
2
by: Roberto Rocco | last post by:
Hello, Whenever I use methods from my class libraries I don't get any Intellisense support of the source documentation I supplied. When I use the same code directly instead (i.e. adding the class...
7
by: Josef | last post by:
Hello, I want to create a C# class library which I can use in an Excel VBA macro. I created a C# class library and set the "Register for COM Interop" option in Visual Studio to TRUE. Now in...
5
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access...
12
by: Chris | last post by:
Hi I am trying to create a base class with the Protected keyword Protected MustInherit Class MyBaseClas .. .. End Clas And I got an error saying something like the Protected keyword...
3
by: Rob T | last post by:
OK....trivial question, but would be nice to have....: Let's say I have simple class like this: Public Class EMailer Public As String ' The Internet address of the recipient Public From As...
1
by: Guoqi Zheng | last post by:
Dear sir, I often developed class/component for other popele. People put a reference to my class and create a new instance for it, when they are assigning properties to that class, I would...
5
by: Len Weltman | last post by:
I am trying to pass a NumericUpDown object into a class method using Visual Studio 2005, but the control type is not found in Intellisense and the type declaration is flagged as an error. Here...
2
by: Fresno Bob | last post by:
I am used to putting my business logic layer etc in the App_code folder in a website project. I want to use class libraries so I can use Sandcastle and NUnit. However unlike a website project I do...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.