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

Recommended Answers

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

Jump to Post

All 4 Replies

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.