Results 1 to 2 of 2

Thread: Return Array from Class

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Houston, TX
    Posts
    342

    Return Array from Class

    How do I return an array from a class??

    For example I have the following:

    Code:
    Public Function GetMessages() AS String
    Dim sMsgs(2000) as string
    
         For J = 1 to 2000
              sMsgs(j) = winsock1.getdata~~~~
         Next J
    
    End function
    How do I return all 2000 sMsgs?

    Thanks!!!

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    Public Function GetMessages() AS String
    Dim sMsgs(2000) as string

    For J = 1 to 2000
    sMsgs(j) = winsock1.getdata~~~~
    Next J

    End function
    You can do this:
    Code:
    Public Function GetMessages() AS String()
    Dim sMsgs(2000) as string
    
         For J = 1 to 2000
              sMsgs(j) = winsock1.getdata~~~~
         Next J
    
    GetMessages = sMsgs
    End function
    or
    Code:
    Public Sub GetMessages(ByRef sMsgs() as String)
         For J = 1 to 2000
              sMsgs(j) = winsock1.getdata~~~~
         Next J
    
    End Sub
    Regards,
    TheBao

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