Error Message

That function is not shared within the form. You'll probably need to
do something like this:

Visual Basic:
Dim myForm As New frmStartup

myForm.exposeAvailableCom()
It probably should work, even though the function is private, because you
are accessing it from within the form.
 
I just saw that When i get rid of the Shared it works (which i did before and didnt) but now i cant access the object from outside that form so I need to put it in a module to make it available to other forms. Isnt that crazy?

about what you said, im not sure i get it. invoke an instance of the form from within that form class...
 
If its only public (and not shared)
then this call from another form:

frmStartup.ComManager.addNewCom(com.Name, com)

I get: "reference to a non-shared member requires an object reference"!
 
That is when you need to declare a new instance of the form to
use it. See my post above.
 
To my understanding shared members are subroutines that can be called *without* instantiating the class in which they are declared.

Consequently, when you have a shared member, it is not allowed to call a non-shared member from there (as this would require the object to be instantiated)

The same (I think) applies to your second error:
Calling a public method of the shared member ComManager.
Is "ComManager.addNewCom" shared, too?

Finally, I think the last suggestion (activeForm) will not help.

***
Perhaps we are having a slight confusion here, between "Static" and "Shared" members, could that be the case?

HTH
Heiko
 
anyways, i just passed a ref of the object to the other form's constructor in order to access it from there.
The "SHARED" is too messy...
thanks anyways...
 
Back
Top