1,105,556 Community Members

how to create a module

Member Avatar
Learner010
Posting Whiz in Training
247 posts since Jun 2013
Reputation Points: 69 [?]
Q&As Helped to Solve: 15 [?]
Skill Endorsements: 12 [?]
 
0
 

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.

Member Avatar
yvrej17_1
Newbie Poster
10 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Replace Dim with Public

Your code
Dim a As Integer=10

Make it
Public a As Integer=10

Member Avatar
Learner010
Posting Whiz in Training
247 posts since Jun 2013
Reputation Points: 69 [?]
Q&As Helped to Solve: 15 [?]
Skill Endorsements: 12 [?]
 
0
 

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

Member Avatar
ddanbe
Posting Expert
5,360 posts since Oct 2008
Reputation Points: 2,066 [?]
Q&As Helped to Solve: 908 [?]
Skill Endorsements: 46 [?]
Featured
 
0
 

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?

Member Avatar
Learner010
Posting Whiz in Training
247 posts since Jun 2013
Reputation Points: 69 [?]
Q&As Helped to Solve: 15 [?]
Skill Endorsements: 12 [?]
 
0
 

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

Member Avatar
ddanbe
Posting Expert
5,360 posts since Oct 2008
Reputation Points: 2,066 [?]
Q&As Helped to Solve: 908 [?]
Skill Endorsements: 46 [?]
Featured
 
0
 

Follow this Success.
But why not use classes?

Member Avatar
shann_
Newbie Poster
6 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article