pauld
Thu Jun 07 12:26:25 CDT 2007
Bryan,
Thanks for the response, but I know I'm missing something because I
don't understand how this will work.
I have a winforms project and I declare a class in the project like
this:
Namespace nsGlobal
Public Class clsGlobal
Public Shared PubSharedString As String = "PubSharedString"
End Class
End Namespace
In the winforms project I have a reference to a separate DLL project.
Obviously the winforms app can instantiate a class from DLL to get a
reference to the class in the DLL, but I don't see how a class
*within* the DLL has any kind of a reference to the class from the
winforms app that instantiated the DLL.
Referencing "nsGlobal" from the DLL project tells me that "nsGlobal is
not declared".
I also tried putting the "nsGlobal" namespace in
"Application.vb" (along with the "My" namespace) and that fared no
better.
What fundamental understanding am I missing here?
Thanks.
On Jun 5, 6:49 pm, "Bryan Phillips"
<bphill...@nospam.spamcop.net.spammenot> wrote:
> Declare the global variables as public and shared:
>
> Namespace SomeNamespace
> Public Class SomeClassName
>
> Public Shared SomeVariableField As Integer = 3
>
> End Class
> End Namespace
>
> Then, inside the DLL access the variables like this:
>
> Dim i As Integer = SomeNamespace.SomeClassName.SomeVariableField
>
> --
> Bryan Phillips
> MCT, MCSD, MCDBA, MCSE
> Blog:
http://bphillips76.spaces.live.com
> Web Site:
http://www.composablesystems.net
>
> "p...@maronsoftware.com" <p...@maronsoftware.com> wrote in message
>
> news:1181082819.305160.176760@o5g2000hsb.googlegroups.com:
>
>
>
> > I want to be able to access some global variables (defined in a
> > winforms "ApplicationEvents.vb") from a DLL.
>
> > I assume I need to pass a reference to the application object to the
> > DLL. If so, how would I define it in the DLL and how would I set it
> > in the main app?
>
> > Is there some other way to get a reference to the DLL instantiator's
> > application object from inside the DLL?
>
> > Thanks.- Hide quoted text -
>
> - Show quoted text -