| gclib 556 Communications API for Galil controllers and PLCs |

Examples.vb
1 ''' <summary>
2 ''' Provides a class of shared constants And methods for gclib's example projects.
3 ''' </summary>
4 Partial Public Module Examples
5 Public Const GALIL_EXAMPLE_OK As Integer = 0
6 Public Const GALIL_EXAMPLE_ERROR = -100
7
8 ''' <summary>
9 ''' Prints the exception to the console And queries the controller for the most recent
10 ''' error message.
11 ''' </summary>
12 ''' <param name="gclib">The gclib object from where the exception originated.</param>
13 ''' <param name="ex">The exception object caught by the example.</param>
14 ''' <remarks>See commands_example.cs for an example.</remarks>
15 Public Sub PrintError(gclib As Gclib, ex As Exception)
16 Console.WriteLine(ex.Message)
17
18 'If exception was Not a GOpen() exception, safe to query
19 'the controller for a human readable error string
20 If Not ex.Message.Contains("-1101") Then
21 Console.WriteLine(gclib.GCommand("TC 1"))
22 End If
23 End Sub
24 End Module