Home All Groups Group Topic Archive Search About

Accessing shared member - need understanding - pretty please :-)

Author
15 Aug 2006 3:15 PM
Bob
I'm trying to use the process class through an instance of the class. As
follows,

Dim MyProc as Process = Myproc.start(Filename) (where filename is a string
variable having the full path of the file to use)

In the IDE (Vs2005 - VB)  I see there is a warning underline on that line
saying that Access of a shared member etc... through an instance, qualifying
expression will not be evaluated.
So I look at the docs, Ok it confirms that it won't work, fine. Question is
HOW do you make it work so that you CAN get the expression evaluated and
executed correctly.
I've seen this message a few times before in other situations, but never
found any info on what to do when you get this or how to do something else
that works.
Any help would be greatly appreciated.
Bob

Author
15 Aug 2006 3:47 PM
Kerry Moorman
Bob,

For shared methods, refer to the method using classname.method, not
object.method:

   Dim MyProc as Process = Process.Start(Filename)

Kerry Moorman

Show quoteHide quote
"Bob" wrote:

> I'm trying to use the process class through an instance of the class. As
> follows,
>
> Dim MyProc as Process = Myproc.start(Filename) (where filename is a string
> variable having the full path of the file to use)
>
> In the IDE (Vs2005 - VB)  I see there is a warning underline on that line
> saying that Access of a shared member etc... through an instance, qualifying
> expression will not be evaluated.
> So I look at the docs, Ok it confirms that it won't work, fine. Question is
> HOW do you make it work so that you CAN get the expression evaluated and
> executed correctly.
> I've seen this message a few times before in other situations, but never
> found any info on what to do when you get this or how to do something else
> that works.
> Any help would be greatly appreciated.
> Bob
>
>
>
Author
15 Aug 2006 5:10 PM
Cor Ligthert [MVP]
Bob,

A shared class is in fact not different from a Module.

You don't have to instance it, it is fixed located in the mainstack of a
program and in fact no OOP.

You can reference it by
SharedClassName.methode or SharedClassName.property or whatever public
member in that Shared class or module.

I hope this helps,

Cor

Show quoteHide quote
"Bob" <bduf***@sgiims.com> schreef in bericht
news:e3xwx2HwGHA.3936@TK2MSFTNGP04.phx.gbl...
> I'm trying to use the process class through an instance of the class. As
> follows,
>
> Dim MyProc as Process = Myproc.start(Filename) (where filename is a string
> variable having the full path of the file to use)
>
> In the IDE (Vs2005 - VB)  I see there is a warning underline on that line
> saying that Access of a shared member etc... through an instance,
> qualifying expression will not be evaluated.
> So I look at the docs, Ok it confirms that it won't work, fine. Question
> is HOW do you make it work so that you CAN get the expression evaluated
> and executed correctly.
> I've seen this message a few times before in other situations, but never
> found any info on what to do when you get this or how to do something else
> that works.
> Any help would be greatly appreciated.
> Bob
>