Please describe me how to use module in vb????
including all kind of modules.........
Brief Description of Module in VBHow to use module & class module in vb
Page 1 of 1
2 Replies - 1861 Views - Last Post: 19 January 2010 - 07:07 AM
Replies To: Brief Description of Module in VB
#2
Re: Brief Description of Module in VB
Posted 19 January 2010 - 06:44 AM
Moved from VB6 Tutorials to VB6.
#3
Re: Brief Description of Module in VB
Posted 19 January 2010 - 07:07 AM
well public functions can be called without declaring variable as the module for example:
in module you have public function
now colling it to display the result on label
if you call it from class you have to do something like that
in class1 you have public function to count to 10
to display it you need to do this
remember if you made a public function in module you can call it every where in your project so do not replicate the name of the public functions or error will show up
here is a test program to see what i mean debug it
in module you have public function
Public Function Count_To_10() As Integer Dim i As Integer 'init. the result of the function to be 0' Count_To_10 = 0 For i = 1 To 10 Count_To_10 = Count_To_10 + 1 'sum 1 every time till i=10' Next End Function
now colling it to display the result on label
Private Sub cmdCountModul_Click() Label1.Caption = Count_To_10 'counting to 10 using module function' End Sub
if you call it from class you have to do something like that
in class1 you have public function to count to 10
Public Function Count_to_10_cls() As Integer Dim i As Integer 'init. count_to_10_cls result to 0 Count_to_10_cls = 0 For i = 1 To 10 Count_to_10_cls = Count_to_10_cls + 1 'sume every time till i=10' Next i End Function
to display it you need to do this
Private Sub cmdCount_CLS_Click() 'count to 10 using class' Dim cCout As New Class1 'int a varaible as new class1' Label1.Caption = cCout.Count_to_10_cls 'count to 10 using class' End Sub
remember if you made a public function in module you can call it every where in your project so do not replicate the name of the public functions or error will show up
here is a test program to see what i mean debug it
Attached File(s)
-
Module_Explain.zip (2.09K)
Number of downloads: 177
This post has been edited by NoBrain: 19 January 2010 - 07:35 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|