RUN-TIME ERROR '40006'

WRONG PROTOCOL OR OR CONNCETION STATE FOR THE REQUEST TRANSACTION OR REQUEST.

that is my problem,, here is my code that has an error.

Private Sub Text2_Keypress(keyascii As Integer)
If keyascii = 13 Then
keyascii = 0
List1.AddItem (Text2.Text)

Winsock1.SendData Text2.Text

Combo1.SetFocus
End If
End Sub

please help me.. im making client/server schedule board. so please help me to solve my problem..

Make sure that you are actually connected. I find the following code helpful

Private Sub Text2_Keypress(keyascii As Integer)
If keyascii = 13 Then
keyascii = 0
List1.AddItem (Text2.Text)

if winsock1.state = 7 then ' 7 means winsock is connected,could use sckconnected  instead
    Winsock1.SendData Text2.Text
else
   msgbox "Can't send message - not connected"
endif

Combo1.SetFocus
End If
End Sub

RUN-TIME ERROR '40006'

WRONG PROTOCOL OR OR CONNCETION STATE FOR THE REQUEST TRANSACTION OR REQUEST.

that is my problem,, here is my code that has an error.

Private Sub Text2_Keypress(keyascii As Integer)
If keyascii = 13 Then
keyascii = 0
List1.AddItem (Text2.Text)

Winsock1.SendData Text2.Text

Combo1.SetFocus
End If
End Sub

please help me.. im making client/server schedule board. so please help me to solve my problem..

sir tnx for the help,. but what i actually need is to transfer the data to the other pc,. what might be missing??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.