as the title , i want to create module for my application . i found that module is used for global declaration or function / procedure defination.

but here i want to ask that how to create a module in vb.net which is applicable to all the window forms of the application(for ex: i put Dim a As Integer=10 then this a will be applicable to form1 as well as form2 and so on ).
whether i have to create another module file what we do in vb6 OR there is something other way to create it. if possible then please put a very simple syntax or code so that i can understand the concept behind module.

Recommended Answers

All 6 Replies

Replace Dim with Public

Your code
Dim a As Integer=10

Make it
Public a As Integer=10

ok.
i replace Dim with pubilc when i will understand how to create a module.

Modules are used(as far as I know) in Visual Basic for Applications, VBA, the macro language used in Excel and Word. Are you referring to that, or do you use something like Visual Studio with VB.NET?

i want to use module in Visual Studio with VB.NET

Follow this Success.
But why not use classes?

i dont know if i get your question right.
You can create module in vb.net by right clicking your application name then click add and click module it then would add something like Module1 in your project.
The other way around is that you can create library classes or dll which i think is much better, you can use it to any application you want. Add Reference - Browse - Select the .dll you have created then Imports it tou your form.

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.