|
-
Mar 10th, 2005, 09:57 PM
#1
Thread Starter
Member
-
Mar 10th, 2005, 10:00 PM
#2
Re: Winsock + Multiple Forms = Trouble
well, wouldnt form1.winsock1.Connect
(change connect) be what you wanted?
-
Mar 10th, 2005, 10:20 PM
#3
Thread Starter
Member
Re: Winsock + Multiple Forms = Trouble
Well that works for the most part but it doesn't work when it comes to dealing with "DataArrival". The "DataArrival" function looks like "Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)" and I have found no way to make it so that is linked to the Winsock on the other form.
-
Mar 10th, 2005, 11:00 PM
#4
Re: Winsock + Multiple Forms = Trouble
Your other form could have a Public Sub or Function that you simply call in the DataArrival event.
VB Code:
Public Sub DataArrivesInThatOtherControlOnThatOtherForm(ByVal bytesTotal As Long)
'do whatever
End Sub
And call that from your other form.
VB Code:
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
TheOtherFormName.DataArrivesInThatOtherControlOnThatOtherForm bytesTotal
End Sub
Of course you would use better names then I do
-
Mar 10th, 2005, 11:26 PM
#5
Thread Starter
Member
Re: Winsock + Multiple Forms = Trouble
I'm not sure I understand what you mean... Could you try to explain that a little better for my puny mind? 
Thanks for your help.
-
Mar 11th, 2005, 03:25 AM
#6
KING BODWAD XXI
Re: Winsock + Multiple Forms = Trouble
VB Code:
'Form 1
private sub tcpWinsock_Dataarrival(Bytestotal as long)
Dim strData as string
tcpWinsock.getdata strData
form2.MyPublicSub strData
End sub
'Form2
public sub MyPublicSub(WinsockData as string)
msgbox WinsockData
end sub
Thats what he means
-
Mar 11th, 2005, 05:43 AM
#7
Re: Winsock + Multiple Forms = Trouble
I've moved this to the Distributed Computing forum,
Ok the methods suggested above would all work, but how about not having any winsocks on the login page?
What i would do is have the connection on frmMain, you can call the connection from the logIn page using frmMain.Winsock.connect (etc) and the dataArrival can be handled on frmMain too.
You can use a prefix to distinguish between chat messages and logIn messages.
I hope this helps, if you are nuse about anything please post back 
Pino
-
Mar 11th, 2005, 05:50 AM
#8
Re: Winsock + Multiple Forms = Trouble
 Originally Posted by Pino
I've moved this to the Distributed Computing forum
Do that with all questions regarding Winsock and the General VB Forum will be cut to half its size This isn't even an n-tier question, so I for one doesn't understand why you moved it here
-
Mar 11th, 2005, 05:58 AM
#9
-
Mar 11th, 2005, 09:22 AM
#10
Re: Winsock + Multiple Forms = Trouble
This forum is for Network questions as well including the winsock control. And hence this post belongs here. 
If you have any further doubts please PM me.
-
Mar 11th, 2005, 09:38 AM
#11
Re: Winsock + Multiple Forms = Trouble
OK, but the question wasn't really about the Winsock control, it's more a multi form question. The question could just as well been related to almost any other control.
-
Mar 11th, 2005, 11:02 AM
#12
Thread Starter
Member
Re: Winsock + Multiple Forms = Trouble
Thank you all for your replies. I found all the information very useful.
I ended up using Pino's method. I'm not sure why I didn't think about that before but it does work. Thank you Pino and thank you to everyone else who helped.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|