Secara default function yang dibuat di Module bertipe Public. Karena itu
jika anda membuat dua module yang berbeda, maka nama function-nya tidak
boleh sama. Lantas bagaimana program dapat mengetahui jika ada dua
fungsi yang bernama sama walaupun berbeda modul? Itu karena, saat
program berjalan, semua fungsi2 module dibaca terlebih dahulu oleh
compiler untuk kemudian menyediaka resource memori yang diperlukan oleh
fungsi2 tersebut.
 
Berbeda dengan module, method2 (dalam module disebut function) dalam
class, berbeda dapat mempunyai nama yang sama. Method dalam class2 hanya
akan dibaca oleh compiler dan disediakan resource memori, ketika method2
tersebut dipanggil. Jadi management memorinya seharusnya lebih bagus
daripada module. 
 
Masalahnya, VB6 tidak benar2 class oriented ... 
 
 
 

Best regards

~subchan

 

 

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of refvi chandra
Sent: Wednesday, March 05, 2008 11:45 AM
To: [email protected]
Subject: [Programmer-VB] Apakah beda Module dengan Class Module...?



Dear vb mania,

Ada yang tau gak beda Class Module dengan Module..?
Ada yang tau kapan dan Kenapa kita butuh Class Module dibanding
Module...

karena selama ini saya cenderung pake Module saja, belum pernah pake
Class Module, kalaupun pake... itu juga Copy Paste...:P

ada yg bilang kalo pake Class Module itu reusable.., tapi menurut saya
Module juga reusable... CMIIW

trus ada yg bilang Class Module itu efisien dan optimizing code..., tapi
menurut saya Module juga efisien dan salah satu upaya optimizing code
juga...CMIIW

contoh Module:
Public Sub SetRS(rsName As ADODB.Recordset, StrRSTmp As String)
'    On Error GoTo Err_SetRS
    Set rsName = New ADODB.Recordset
    Set rsName.ActiveConnection = ConData
    If rsName.State = adStateOpen Then rsName.Close
    rsName.CursorLocation = adUseClient
    
 ! ;   rsName.Open StrRSTmp, ConData, adOpenStatic, adLockOptimistic
    Exit Sub

Err_SetRS:
    
    If rsName.State = adStateOpen Then rsName.Close
    Set rsName = Nothing
End Sub

naahh... pada saat penggunaan di form kita cukup seperti ini aja

Setrs rsTable, "Select * From Karyawan"

jadi cukup singkat bukan...?... CMIIW

yaaa.... kalo saya sih.. taunya seperti itu...
mungkin teman2 ada yg lebih paham dan kalau tidak keberatan.., mohon
dijelaskan lagi soal pentingnya Class Module pada VB

Regards,







________________________________

Looking for last minute shopping deals? Find them fast with Yahoo!
Search.
<http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsear
ch/category.php?category=shopping>  

 


This email and any attachments are confidential and may also be privileged.  If 
you are not the addressee, do not disclose, copy, circulate or in any other way 
use or rely on the information contained in this email or any attachments.  If 
received in error, notify the sender immediately and delete this email and any 
attachments from your system.  Emails cannot be guaranteed to be secure or 
error free as the message and any attachments could be intercepted, corrupted, 
lost, delayed, incomplete or amended.  Standard Chartered PLC and its 
subsidiaries do not accept liability for damage caused by this email or any 
attachments and may monitor email traffic.

 

Standard Chartered PLC is incorporated in England with limited liability under 
company number 966425 and has its registered office at 1 Aldermanbury Square, 
London, EC2V 7SB.

 

Standard Chartered Bank ("SCB") is incorporated in England with limited 
liability by Royal Charter 1853, under reference ZC18.  The Principal Office of 
SCB is situated in England at 1 Aldermanbury Square, London EC2V 7SB. In the 
United Kingdom, SCB is authorised and regulated by the Financial Services 
Authority under FSA register number 114276.

 

If you are receiving this email from SCB outside the UK, please click 
http://www.standardchartered.com/global/email_disclaimer.html to refer to the 
information on other jurisdictions.

Kirim email ke