Lost Password?

  #1 (permalink)  
Old 10-15-2006, 04:36 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,709
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Exclamation VB6.0:Tutorial, Error handling

Introduction:-
Ok So I decided to make a tutorial about error handling! Many programs don't contain error handling but I suggest you that you include it! This will make your program more powerful

Solution:-
Ok so I am going to show you this code then I will expalin it. I will show you 3 types of error handling

What you need:-
  • 3 Command buttons
  • Some time

Here is the code
Code:
Private Sub Command1_Click()
On Error GoTo ErrorHandler
Error 424 'This error is displayed when there is a missing object
Exit Sub
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End Sub

Private Sub Command2_Click()
On Error GoTo ErrorHandler
Error 424
Exit Sub
ErrorHandler:
If Err.Number = 424 Then
MsgBox "A missing object in your form is needed!, Please refer to the code and arrange accordingly!"
Else: MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End If
End Sub

Private Sub Command3_Click()
On Error Resume Next
Error 424 'This error is displayed when there is a missing object
MsgBox "error ignored!"
End Sub
Explanation:-
Code:
On Error GoTo ErrorHandler
This will tell the program that when an error is found it will call the 'chunk' of code named ErrorHandler ( you will see it in a while )

Code:
Error 424 'This error is displayed when there is a missing object
Exit Sub
This will generate an error, instead of this code you will have your code here, I just made that for an error to be generated so DON'T include that in your program this is just for testing purposes!!! and the 2nd line is there so to IF no error occurs the 'chunk' of code named ErrorHandler will not be executed



[code]
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End Sub
[code]
This will be the action that will be done when an error occurs it will show you the error number and the description!

Code:
ErrorHandler:
If Err.Number = 424 Then
MsgBox "A missing object in your form is needed!, Please refer to the code and arrange accordingly!"
Else: MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
End If
This will be found on the Command2 event instead this type of error handling is when the programmer knows for example that when something is done the error will popup so he should make this type of error handling so not to let his program crash. here I edded IF .... THEN.... ELSE so IF the error number is 424 THEN it will do something or if not ELSE it will show the first method



Code:
On Error Resume Next
Error 424 'This error is displayed when there is a missing object
MsgBox "error ignored!"


Here we are telling the program to just IGNORE the error and continue the next action ( in this case show a msg box )

Conclusion:-
As Always Feedback is welcome and the full source is attached!!
Attached Files To view attachments your post count must be 1 or greater. Your post count is 0 momentarily.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help

Last edited by Jordan; 10-21-2006 at 11:03 AM. Reason: Images moved to local server
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 11-26-2006, 06:41 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,709
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

OMG pls Jordan can you remove this spammers post thanks!
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-26-2006, 10:33 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 25
Posts: 4,512
Last Blog:
Zend: PHP Security Web...
Rep Power: 50
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Wow, that is the 4th one I have removed from this tutorial. They really like this one!
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-26-2006, 11:57 AM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,709
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Lol! its my tutorial of course they like it!! lol just kidding! duh damm spammers! they are all over the net!!
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-26-2006, 12:03 PM
xXHalfSliceXx's Avatar   
xXHalfSliceXx xXHalfSliceXx is offline
Co-Administrator
 
Join Date: Oct 2006
Location: Hendersonville, NC
Age: 24
Posts: 1,120
Rep Power: 50
xXHalfSliceXx is just really nicexXHalfSliceXx is just really nicexXHalfSliceXx is just really nicexXHalfSliceXx is just really nicexXHalfSliceXx is just really nice
Send a message via AIM to xXHalfSliceXx Send a message via MSN to xXHalfSliceXx Send a message via Yahoo to xXHalfSliceXx
Default

Suggested that we enable Image Verification on registration. I made a thread about it for the Mods/Admins to comment.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Company
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 11-26-2006, 12:23 PM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,709
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Quote:
Originally Posted by xXHalfSliceXx View Post
Suggested that we enable Image Verification on registration. I made a thread about it for the Mods/Admins to comment.
Well I sugegsted another thing in here:-
http://forum.codecall.net/hosting-do....html#post8774
This would definitely make it harder!!
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help

Last edited by TcM; 11-26-2006 at 12:26 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-26-2006, 12:25 PM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,709
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default

Quote:
Originally Posted by Jordan View Post
Wow, that is the 4th one I have removed from this tutorial. They really like this one!
Well perhaps because it has 4 votes? as rating? I really dont know!!
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-20-2008, 03:13 AM
mathewbuer.com mathewbuer.com is offline
Newbie
 
Join Date: Jan 2008
Posts: 1
Rep Power: 0
mathewbuer.com is on a distinguished road
Default

i am hqavin a javascript error will this resolve this issue?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-04-2008, 09:34 PM
utardylan utardylan is offline
Newbie
 
Join Date: May 2008
Posts: 1
Rep Power: 0
utardylan is on a distinguished road
Send a message via MSN to utardylan
Thumbs down Re: VB6.0:Tutorial, Error handling

i will take a look
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 06-06-2008, 01:31 PM
TcM's Avatar   
TcM TcM is offline
Terminator - I'll be back
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 5,709
Rep Power: 47
TcM is a jewel in the roughTcM is a jewel in the roughTcM is a jewel in the rough
Default Re: VB6.0:Tutorial, Error handling

Quote:
Originally Posted by mathewbuer.com View Post
i am hqavin a javascript error will this resolve this issue?
This is a VB tutorial not a JS one.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


Business Directory | Technology Blog | Windows Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6.0:Tutorial, WipeFile TcM VB Tutorials 8 06-11-2008 11:33 AM
VB6.0:Tutorial, Command Line TcM VB Tutorials 6 01-12-2007 07:34 AM


All times are GMT -5. The time now is 06:01 PM.

Contest Stats

John ........ 87.50000
dargueta ........ 75.00000
Xav ........ 50.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads