VB.net Reference to a non-shared member Error?

S

Steve Ricketts

I'm new to VB.net and using VB Studio 2008 to experiment with what it takes
to change from VB 6.0. I took a simple VB6 .dll and it converted it into
..net format. There is one error that I don't understand. In the .dll
control (clsWebTalk.vb) I reference a public function (connectToServer) in
a form (frmWebTalk)

I get an error, "Reference to a non-shared member requires an object
reference on the following statement:

call frmWebTalk.connectToServer(serverIP)

Help says, 1. declare the instance as an object variable and 2. Reference
the instance by the variable name.

I tried declaring a form object but apparently didn't do that right either.

Any direction would be greatly appreciated.

sr
 
H

Herfried K. Wagner [MVP]

Steve Ricketts said:
I'm new to VB.net and using VB Studio 2008 to experiment with what it
takes to change from VB 6.0. I took a simple VB6 .dll and it converted
it into .net format. There is one error that I don't understand. In the
.dll control (clsWebTalk.vb) I reference a public function
(connectToServer) in a form (frmWebTalk)

I get an error, "Reference to a non-shared member requires an object
reference on the following statement:

call frmWebTalk.connectToServer(serverIP)

Help says, 1. declare the instance as an object variable and 2. Reference
the instance by the variable name.

Try the following:

\\\
Dim f As New frmWebTalk()
f.connectToServer(serverIP)
///

If this doesn't work, try 'My.Forms.frmWebTalk.connectToServer(serverIP)'.
 

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