How do I detect A when VB programming? Is it driven without disk or disk write protection?

zhaozj2021-02-08  241

In some software, we will find that when the software runs to the A-write write file, it automatically detects A. If the user does not drive into the disk as required, the program prompts the user to insert the disk into the A drive; if you need to write a file to a, the disk "write protection", the program is unable to Write files, programs will also prompt users to remove the "write protection" of the disk. Can this intelligent prompt function to implement in VB? The answer is yes! People who write programs with VB should know that there is a very useful statement in VB: ON Error's role is to start an error handler and specify the position of the subroutine in a process; can also be used to prohibit one error handling program. Its syntax: ON Error Goto Line on Error Resume Next ON Error Goto 0 ON Error statement syntax can have any of the following:

The statement describes the ON ERROR GOTO LINE launches the error handler, and the routine begins with the LINE specified in the necessary LINE parameters. The LINE parameter can be any row tag or line number. If a runtime error occurs, the control will jump to line, activate the error handler. The specified line must be in a process, this process is the same as the on ERROR statement; otherwise the compilation time error will occur. ON Error Resume Next Description When a runtime error occurs, the control goes to the statement following the incorrect statement, and continues to run here. Use this form while accessing the object without using the ON Error Goto. ON Error Goto 0 prohibits any initiated error handler during the current process.

转载请注明原文地址:https://www.9cbs.com/read-2254.html

New Post(0)