PDA

Click to See Complete Forum and Search --> : Why does the "New" keyword generate an error??


sydneyfong
Jan 9th, 2000, 07:45 PM
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

Fox
Jan 9th, 2000, 08:10 PM
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
gigotz@gmx.net
[No homepage yet]