41-Modules

0
488

This Visual Basic tutorial is all about Modules.
A module is quite similar to a class but every module has exactly one instance and it does not need to be assigned to a variable and does not support an inheritance.

 

A module last a lifetime same as your program because all of its members are Shared. Modules access levels can be adjusted with the access modifier.

 

Example:

  • Open the Visual Basic, select “File” on the menu, hit new and create a new project.
    01_helloworld
  • The New Project dialog will appear.
    create2s
    Select “windows” in the project types, hit the “windows form application” in the templates and hit “ok“.
  • Go to the solution explorer. Right click the application, click add and select a Module.
    modulesf1
  • The add new Item dialog will appear and do the process like what is shown below.
    modulesf2
  • Add the following code in the Module1
 

  • Design the form just like shown below.
    modulesf3
  • Go to the form design and double click a button to fire the click event handlerof it. Add this following code in the method.
Output:

modulesf4

 

 

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.