Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   problem with my chat client (http://www.programmingforums.org/showthread.php?t=12776)

demon101 Mar 13th, 2007 5:11 AM

problem with my chat client
 
1 Attachment(s)
i am having trouble with my chat client it is coming up and saying unsupported variant type.

so here is my code i have.

:


Private Sub bntSend_Click()
On Error GoTo t
sock1.SendData txtSend
txtLog = txtLog & "Client : " & txtSend & vbCrLf
Exit Sub
t:
MsgBox "Error : " & Err.Description
sock1_Close
End Sub


that is the code that is causing the problem.

it is the code that sends the text you typed to the other person and that is when the error comes up and when the error comes up it disconnects you from the server.

when you open the client program the ip and port in there is the server i have for the program to run on or you could open the server program and use your computer as the server.

and this is coded in visual basics 6

here is the download too for the server and client

demon101 Mar 13th, 2007 3:19 PM

1 Attachment(s)
well i sat down and went through all my coding and it working now



here is the working version of my chat client/server

PhilBon Mar 13th, 2007 7:18 PM

my Suggestion, DO NOT USE GOTO statements. If you do I will make a program for you, that will be goto statement after goto statement, etc. They make your code look ugly. If you want to use error handling use exceptions, if you don't want to use exceptions then use if statements, just not goto statements. Help keep the world sane.

DaWei Mar 13th, 2007 7:25 PM

Goto statements, while not inherently evil, generally are a sign of a coder who has not mastered the simplicities of loops and branching constructs. While their equivalent (branches/jumps) are an integral part of assembly-language programming, you will find that they are often automatically provided by higher-level languages in the form of block delimiters (end statements, opening and closing parentheses, etc.).

The first line of attack is to realize that you're needlessly complicating matters and causing untold tons of grief to those who follow and maintain. None of that matters, of course, if you have no intention of being a pro or of disseminating your code, or of asking for help.

Ooble Mar 15th, 2007 10:35 AM

Unfortunately, using GoTo is basically the only way of handling errors in Visual Basic. My recommendation would be to switch to Visual Basic .NET (now Visual Basic 2005), but that requires a lot of hard work, especially if you need to port a program.

Out of curiosity, how did you fix the problem?

demon101 Mar 15th, 2007 10:46 AM

the textbox on the program where you typed your stuff in before you hit the send button i forgot to rename the text box from

textbox1 to txtsend


All times are GMT -5. The time now is 3:12 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC