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.

Recommended Answers

All 5 Replies

You need to read books for all that.

Read this and this.

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..

commented: agree +13

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


Rgrds

Sam

Hope this might provide some light on the matter as well.

commented: the link neatly explains. +13
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.