-
November 11th, 2009, 03:40 AM
#1
On error goto....
Hi. I have made an program with a winsock control. A chat program. Then if the winsock isint connected and you try to send something comes an error. When I put in on error goto Handler and write the 'Handler', it goes through even without a error.
Help...
And another question.
When I save my project and press the button, make NameOfFile.exe there comes up an error: Permission denied to "C\Location\". This happends sometimes, not allways. Whats the problem?
-
November 11th, 2009, 03:54 AM
#2
Re: On error goto....
Originally Posted by Equx
When I save my project and press the button, make NameOfFile.exe there comes up an error: Permission denied to "C\Location\". This happends sometimes, not allways. Whats the problem?
I guess I can help here
Before trying to compile ( MAke EXE ), make sure al the processes of your app has been destroyed. Meaning, make sure your program exits correctly. If you still have running processes of your program, while trying to make the exe again, you will get errors.
-
November 11th, 2009, 07:07 AM
#3
Re: On error goto....
Yes. Winsock sometimes leaves processes running in the background, when aborted or stopped on errors.
To help you build a working error handler, we'd have to see what you did, that it won't trap the error as would be expected.
-
November 11th, 2009, 09:21 AM
#4
Re: On error goto....
Originally Posted by WoF
Yes. Winsock sometimes leaves processes running in the background, when aborted or stopped on errors.
To help you build a working error handler, we'd have to see what you did, that it won't trap the error as would be expected.
OK Ty.
Here is one example:
Private Sub Form_Load()
On Error GoTo Errorhandler
MsgBox "Hello World!"
Errorhandler:
MsgBox "Error!"
End Sub
Here when you start up the program both two msgboxes comes up...
-
November 11th, 2009, 09:30 AM
#5
Re: On error goto....
OK, that helps a bit.
How did you configure your Winsock control, any other code ¿
-
November 11th, 2009, 09:58 AM
#6
Re: On error goto....
Originally Posted by HanneSThEGreaT
OK, that helps a bit.
How did you configure your Winsock control, any other code ¿
what do you exact mean?
-
November 11th, 2009, 10:00 AM
#7
Re: On error goto....
CAn you upload your project here in zip format ¿
-
November 11th, 2009, 10:46 AM
#8
Re: On error goto....
Originally Posted by HanneSThEGreaT
CAn you upload your project here in zip format ¿
I dont want other to get the code so I send you a PM with the download link!
-
November 11th, 2009, 10:52 AM
#9
Re: On error goto....
But you expect others to help you ¿
This is a public forum, where all of us must share with each other.
If you don't want everyone to see your code, fine that is your perogative, but you have to understand, that, without your code we cannot help you - do you understand that ¿
We are all helping voluntary, we don't get anything except the satisfaction of helping others like you.
Again, if you want us to help you, give the code so that we can help you.
Take it, or leave it!
-
November 11th, 2009, 11:00 AM
#10
Re: On error goto....
Originally Posted by HanneSThEGreaT
But you expect others to help you ¿
This is a public forum, where all of us must share with each other.
If you don't want everyone to see your code, fine that is your perogative, but you have to understand, that, without your code we cannot help you - do you understand that ¿
We are all helping voluntary, we don't get anything except the satisfaction of helping others like you.
Again, if you want us to help you, give the code so that we can help you.
Take it, or leave it!
Can I only post the part of code where I need help?
*****
' Error code:
On Error GoTo Handler
Dim text As String
text = Text1.text
Dim username As String
username = Settingsform.Text1.text
If username = "" Then
Chatform.Combo1.AddItem "Please fill in a username!"
Else
Connectform.Winsock1.SendData username & " says : " & text
Chatform.Combo1.AddItem username & " " & "says : " & text
End If
Text1.text = ""
' Error Handler
Handler:
Combo1.AddItem "#Error! Please connect first!"
End Sub
Last edited by Equx; November 11th, 2009 at 11:03 AM.
-
November 11th, 2009, 01:24 PM
#11
Re: On error goto....
Originally Posted by Equx
OK Ty.
Here is one example:
Private Sub Form_Load()
On Error GoTo Errorhandler
MsgBox "Hello World!"
Errorhandler:
MsgBox "Error!"
End Sub
Here when you start up the program both two msgboxes comes up...
Here is a simple solution to your problem.
Code:
Private Sub Form_Load()
On Error GoTo Errorhandler
MsgBox "Hello World!"
Exit Sub
Errorhandler:
MsgBox "Error!"
End Sub
Without Exit Sub, both the message boxes will be shown. You have to tell the program when to execute what piece of code. Exit Sub ensures that the code in the error handler does not get called unless there is an actual error.
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
|