LocoBird 0 Newbie Poster

I made a simple chat program and file send (server/client) type. everything works fine when i run them in the IDE but after i make them EXE and test them when i do the file send the program that the file is being sent to just closes. the chat part works fine. It sends the file fine when i run the client and server from IDE.
Any help welcome please.


heres the code that crashes.

Winsock1.GetData data, vbString
data2 = Left(data, 4)
Select Case data2
Case "rqst"  'file request arrives
data3 = Right(data, Len(data) - (4)) 'Get the file name
Dim msg1 As Integer  'Stores user's selection
msg1 = MsgBox(Winsock1.RemoteHostIP & " wants to send you file " & data3 & " accept ? ", vbYesNo, "Manjit")  'msgbox displayed

If msg1 = 6 Then  'if user selects yes
Winsock1.SendData "okay"
cd.FileName = data3
data5 = Split(data3, ".")(1)
data6 = "*." & data5
data7 = "Orignal extension (" & data6 & ") |All Files (*.*)|*.*"
cd.Filter = data7

cd.ShowSave
data4 = cd.FileName
Open data4 For Binary As #1      ***I think this i were it crashes**
Else
Winsock1.SendData "deny"
Exit Sub
End If

Case "EnDf"
MsgBox "File recieved!!!", , "RedeyeS"
size = 0
sz = 0
Close #1
Case Else
size = size + 1
sz = size * 8

Put #1, , data
End Select
End Sub

agin Remember this code werks perfect when ran in the IDE.
thank for any help.

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.