In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "the usage of On Error sentence in VBS". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the use of On Error sentences in VBS".
Enables or disables error handlers.
On Error Resume Next
On Error GoTo 0
Description
If you do not use the On Error Resume Next statement in your code, the runtime error that occurs displays the error message, and the execution of the code terminates. But the exact action is determined by the host running the code. The host can sometimes selectively deal with all kinds of errors. In some cases, it can activate the script debugger where something went wrong. In other cases, because the host cannot notify the user, there is no clear indication of the error that occurred. How to handle errors depends entirely on the functionality of the host.
In any particular procedure, as long as the error handler is enabled at the call stack, the error that occurs is generally not fatal. If a local error handler is not enabled in a procedure, control can be transferred through stack calls when an error occurs until a procedure with an error handler is found and the error is handled where the error occurs. If no error handler is found during the call stack, the error message is displayed where the error occurs and the code execution is terminated, or the error is handled correctly through the host.
On Error Resume Next causes the program to continue to execute according to the statement that produced the error, or to continue to run according to the statement in the last called procedure, which contains the On Error Resume Next statement. This statement continues to execute the program regardless of run-time errors, after which you can create error-handling routines within the procedure. When another procedure is called, the On Error Resume Next statement becomes inactive. Therefore, if you want internal error handling in your routine, you should execute the On Error Resume Next statement in each of the called routines.
The use of On Error Resume Next statements is prohibited when calling another procedure, so if you want to embed an error handler in a routine, you need to execute the On Error Resume Next statement each time the routine is called. When you exit a procedure, the error handler can return to the state it was in before it entered the exited process.
If you have enabled the On Error Resume Next error handler, you can use On Error GoTo 0 to disable the error handler.
The following example illustrates how to use the On Error Resume Next statement:
On Error Resume NextErr.Raise 6 'generated an overflow error. MsgBox ("Error #" & CStr (Err.Number) & "& Err.Description) Err.Clear 'clears the error. At this point, I believe you have a deeper understanding of "the use of On Error sentences in VBS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.