Results 1 to 2 of 2

Thread: Why does the "New" keyword generate an error??

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 1999
    Location
    HKSAR
    Posts
    9

    Post

    I tried to create new (winsock) objects with code... didn't succeed... ( I did get on well creating new forms though)
    ( I put a winsock control named winsock1 in the form )

    I tried

    Dim winsk as Winsock
    set winsk = new Winsock
    (error : Invalid use of New Keyword)

    Dim winsk as Winsock
    set winsk = new Winsock1
    (error : User Defined type not defined)

    Dim winsk as Winsock
    Set winsk = new Form1.Winsock1
    (error : User Defined type not defined)

    Dim winsk as new Winsock
    (error : Invalid use of New Keyword)

    Dim winsk as new Winsock1
    (error : User Defined type not defined)

    (I tried using "Dim winsck as Object" too, same results)

    Anyone got any ideas?

    PS :
    Suddenly I remember that I can create new forms that contain a winsock control, then use it from there... But if you got a better method please tell me. Thanks

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088

    Post

    AFAIK you can only create forms with this method. If I'd like to create a Windsock I'd use the load method. First, set the index for your WinSock (in edit mode) to 0. Then try this:

    -

    Load Form1.WinSock1(1)

    -

    Now you can use both Winsock like this:

    [list}
    WinSock(0).Listen
    WinSock(1).Listen[/list]

    P.S.: You should be able to link a var to the created WinSock-object. Don't really know if it works, but I think so.

    ------------------
    Fox
    [email protected]
    [No homepage yet]


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