Paul,
You need to ensure you've added a reference to the assembly that
contains your static/shared property or field variable to the
"project" that will need to use the value. You can do this by
accessing the "References" tab on the project properties screen in
Visual Studio and clicking "Add". Look into "Adding project or
assembly references to projects" on MSDN or the web for more info.
After you add the assembly reference to the project that wants to
reference the variable you then refer to it using a fully qualifed
name as demonstrated in someone's previous response to your original
post. For example:
Dim myLocalString =
MyReferencedAssemblyNamespace.MyClassInThatAssembly.MySharedStringVariable
I believe your problem is largely due to not having the assembly
referenced in your project.
HTH,
Geoff
[quoted text, click to view] On Jun 14, 11:27 am, p...@maronsoftware.com wrote:
> 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.
>
> I RECEIVED A PRIOR RESPONSE THAT I DIDN'T UNDERSTAND:
> 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