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

B

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
 
G

Guest

Bob,

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

Dim MyProc as Process = Process.Start(Filename)

Kerry Moorman
 
C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top