I would like to know how to use module, why we need to use module and when to use module. I've tried to use module but some of my textboxes, labels and other controls didn't recognize by the module i've created.

Attachments module.png 11.66 KB
5 Years
Discussion Span
Last Post by codeorder

Module normally contain methods that are project wide available.
So lets say you have this module:

Module Helper

Public function Blubb(byval x as integer, byval y as integer) as integer
     Return x + y
End function

End Module

You then can use this function in your forms like

txtTest.Text= Helper.Blubb(12, 7)

Module are also holding any extensions that you define in your projects.


Usually Module should contain the method or functions which can be used in all the forms of projects. Example: Error handler code, database connections etc..


Hi Khentz

As already explained Modules are used to keep procedures (Functions) which is used throughout the entire solution ...

For example...Transformation matrix, Rotation matrix etc.. Here is a typical example

Public Class ObjectHolder
Dim A as list (of Mycurves)
Private sub CurveInitialize

End Sub

Private sub CurveTransformAxial

End Sub

Private sub CurveRotate

End Sub

End class

Public class MyCurves
 Private L as list (of Lines)

End class

Public class MyLines
 Private P as list (of Points)
  Public sub New()'---
'----Calls for the general initalization procedure from the module

End sub
End class

Public Class MyPoints
 Private StartPoint as system.drawing.point
 Private EndPoint as system.drawing.point

End class

Now u have a set of curves in 2D drawing area...All curves are made of small lines of length dx & all lines has two points ....
For the initialization of these curves associated with a set of general procedure like transformation matrix to be expressed in cartesian coordinate system etc...it depends
Also if the curve has to be rotated around an axis each objects defined has to call for the general rotation matrix procedure...
So we keep these set of procedures in a module

Module Matrices
Public function TransformationMatrix(Byref TemL as MyLines)

End Function

Public function RotationMatrix(Byref TemL as MyLines)

End Function
End Module

Most of the CAD software uses same kind of structure



This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.