function not available

function not available

am 31.01.2008 00:52:18 von Shapper

Hello,

I am working on a library which namespace is Parent.

Then I have 2 classes inside the following namespaces:

Class A > Namespace Parent.Base.Common

Class B > Namespace Parent.Web.UI.WebControls

I have a function inside class A as follows:

Public Function FindAll ...

From class B I am not able to access this function.

The only way to solve this is to make:

Public Shared Function FindAll ...

And in class B, where I use the function Find All, use:

Imports Base.Common

My question is:
Is this the only way to do this?
Class A and Class B are under a same namespace, i.e., Parent.

Shouldn't I from Class B be able to access a function in Class A?

Thanks,
Miguel

RE: function not available

am 31.01.2008 01:11:02 von brucebarker

there are static (shared in vb) and instance methods. instance methods can
only be called from a class instance, otherwise this (me in vb) is undefined.

-- bruce (sqlwork.com)


"shapper" wrote:

> Hello,
>
> I am working on a library which namespace is Parent.
>
> Then I have 2 classes inside the following namespaces:
>
> Class A > Namespace Parent.Base.Common
>
> Class B > Namespace Parent.Web.UI.WebControls
>
> I have a function inside class A as follows:
>
> Public Function FindAll ...
>
> From class B I am not able to access this function.
>
> The only way to solve this is to make:
>
> Public Shared Function FindAll ...
>
> And in class B, where I use the function Find All, use:
>
> Imports Base.Common
>
> My question is:
> Is this the only way to do this?
> Class A and Class B are under a same namespace, i.e., Parent.
>
> Shouldn't I from Class B be able to access a function in Class A?
>
> Thanks,
> Miguel
>