Results 1 to 2 of 2

Thread: class module simpel question.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    259

    class module simpel question.

    Hi friends,

    I have a class mudule and i have called it log.
    I have some options in that class so i can for exaple scan a logfile wit it and ask the username. For example msgbox log.username
    My question now is how can i add more options for that username. for example log.username(x).name or log.username(x).phonenr

    the code i have now is:

    Public Function user() As String
    user = ..........
    End Function


    thanks,

  2. #2
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170
    yeah, good u kno its a simple question
    just hope i can explain it smoothly to make it seem so. :P


    note that vb6 has no polymorphysm,
    so you cannot define
    a function .username and another .username(x).
    (ignore this if you dont get it)

    here is a small example code:
    VB Code:
    1. 'class logs
    2. 'depends on another class called UserInfo
    3. Public Property Get UserName(X as Long) as UserInfo
    4. CollectInfo(UserName, X)
    5. End Property
    6.  
    7. Public Sub CollectInfo(User as UserInfo, X as Long)
    8. '''some code to set User to the wanted state
    9. End Sub
    10.  
    11. '----------------
    12. 'class UserInfo
    13. Private Name as String
    14. Private ID as Long
    15.  
    16. Public Property Get Username() as String
    17. Username=Name
    18. End Property
    19.  
    20. Public Function phonenr
    21. ''' whateva u want ;)
    22. End Function

    hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width