Runs the tool. This method is guaranteed to not throw an
exception. Any exception generated in the course of running
the tool will be caught and packaged in the tool's
RunStatus.Exception. Should this occur, the tool's RunStatus.Result
will be set to Error and its RunStatus.Message will reference the
message that accompanied the exception. It is the user's
responsibility to examine the tool's RunStatus after calling Run.
Namespace: Cognex.VisionPro.ImplementationAssembly: Cognex.VisionPro (in Cognex.VisionPro.dll) Version: 93.1.0.0 (93.1.0.0)
Syntax
Implements
ICogTool RunExamples
Imports Cognex.VisionPro
Private Function RunTool() As Boolean
mTool.Run() ' a previously created and configured tool ...
Dim aRunStatus As Cognex.VisionPro.ICogRunStatus = mTool.RunStatus
If (aRunStatus.Result = CogToolResultConstants.Error) Then
If (Not aRunStatus.Exception Is Nothing) Then
MessageBox.Show("Exception: " + _
aRunStatus.Exception.ToString())
End If
If (Not aRunStatus.Message Is Nothing) Then
MessageBox.Show("Message: " + _
aRunStatus.Message)
End If
RunTool = False
Else
RunTool = True
End If
End Functionusing Cognex.VisionPro; private Boolean RunTool() { mTool.Run(); // a previously created and configured tool ICogRunStatus aRunStatus = mTool.RunStatus; if (aRunStatus.Result == CogToolResultConstants.Error) { if (aRunStatus.Exception != null) MessageBox.Show("Exception: " + aRunStatus.Exception.ToString()); if (aRunStatus.Message != null) MessageBox.Show("Message: " + aRunStatus.Message); return false; } else return true; }
See Also