Hi patang,
Have a read of this blog entry I wrote that goes over this:
http://agoossens.blogspot.com/2005_0...s_archive.html
Check the paragraph titled "Members of a module are scoped to the
surrounding namespace of their module."
I've been having issues with blogger lately so I've given up any form of
blogging :p
Members of modules are scoped to their surrounding namespace. So, as
long as you import the namespace of the module you can access it's
members automatically.
"Under-the-hood" the VB.NET compiler applies the StandardModule
attribute to your Module. When you compile code that calls the members
of this module, the VB.NET compiler automatically replaces them with
their properly qualified versions.
IE, this:
---
Console.WriteLine(connectionString)
---
Becomes this:
---
Console.WriteLine(Module1.connectionString)
---
Hope that helps,
-Adam.
patang wrote:
Very simple question.
I have a project with multiple forms and a Module1. In Module1 I have
written the connectionstring:
Module Module1
Public connectionstring = "provider=Microsoft.Jet.OLEDB.4.0;data source=" +
Application.StartupPath + "\mydatabase.mdb;"
End Module
In Form I am using this "connectionstring" form.
Ok..now here is the question. How come this variable is available
(automatically) in other forms even though I haven't imported Module1 in
those forms?
Thank you in advance.