Results 1 to 6 of 6

Thread: Winsock in array quesiton

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    14

    Winsock in array quesiton

    oooook here we go

    I would like to make this simpler right now i have 4 different arrays which could be simplified all into a single array if i can get the answer to this..

    how do you handle the controls of winsock (dataarival, connection) if its with in an array.

    this is a sample of my array setup notice the winsock.

    Type userdata
    winsock As winsock
    pos As posdata
    stats As statdata
    status As Integer
    userinfo As userinfodata
    End Type
    Global users() As userdata

  2. #2
    Hyperactive Member MikeBAM's Avatar
    Join Date
    Sep 2000
    Location
    Metro Detroit
    Posts
    284
    don't understand
    ~* )v( ! /< E *~

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try making a "control" array then in the events it'll list an Index argument that will tell you which member of the array the event is coming from.

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    14
    yeah, but how will that work within a user type.

    can you make an example?

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well it really wont, why does it need to be part of a UDT?
    Or you could probably have the app create the array and assign it to the UDT. Although you may want to switch to a class and hae more control over what happens when values are assigned to the properties and what not, but that's just a suggestion.

    VB Code:
    1. Type userdata
    2.    winsock As winsock
    3.    pos As posdata
    4.    stats As statdata
    5.    status As Integer
    6.    userinfo As userinfodata
    7. End Type
    8.  
    9. Global users() As userdata
    10.  
    11. 'then when you are filling in your parts
    12. set users(1).winsock=wsControlNameHere(1)

    Although really it might be better to just store the index of the control array instead of a reference to an existing winsock control.

    SO if users(1) maps to winsock(5) then just store the 5 in the winsock part of the UDT as a long instead of winsock and then when you want to use that person's winsock:

    VB Code:
    1. Type userdata
    2.    winsock As long 'notice the change
    3.    pos As posdata
    4.    stats As statdata
    5.    status As Integer
    6.    userinfo As userinfodata
    7. End Type
    8.  
    9. Global users() As userdata
    10.  
    11. 'then when you are filling in your parts
    12. set users(1).winsock=wsControlNameHere(1).index
    13.  
    14. wsControlNameHere(users(1).winsock).SendData "Here you are"
    Last edited by Edneeis; Dec 19th, 2001 at 02:09 PM.

  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    14
    thanks, your example worked quite well.

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