How to use 1 module or function which manages a single Connection in vb.net

make the module public and declare any sub, function or variable as public, and they will be accessible to the whole project.

thank u for ur reply

Is this module can be called inside Applicationevents.
If yes how?

Application Events like in a button click? Yes you can, Declare your module as public:

Module *Name of module*

Public Con As SqlClient.SqlConnection

Public sub Connect

Your connection here

end sub

end module

Then an button event use:

Call Connect

Hope that helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.