Visual Basic函數中的錯誤控制舉例如下: Sub DoSomething On error goto ErrHandler < -- (VB錯誤控制語句) code.....code .... code .... If an error occurs in this section the control is automatically transferred to the ErrHandler section below. code.....code .... code .... ErrHandler: All errors come here and hence this section can be used to handle errors PReventing the user from seeing them. End Sub