sboyko

Try/Catch and the SDK

Discussion created by sboyko on Aug 31, 2009
Latest reply on Sep 2, 2009 by sboyko

Please help a relative newbie to VB.NET programming here. I have a snippet of code that calls GetPointsSQL. When no points match, VB throws an exception but I don't know how to catch it properly. All the sample PISDK code I have seen catches the generic "ex as Exception" but I want to catch the specific error pseNOPOINTSFOUND and deal with it differently. How do I do that?


Public Sub GetPIPointList()
   Dim sSQL As String
   Dim ptlist As PISDK.PointList
   Try
      sSQL = "(PointSource = '" & gPointSource & "')"
      ptlist = srv.GetPointsSQL(sSQL)
   Catch ex As Exception
      WriteErrorMessage("GetPIPointList: Error " & ex.Message)
   End Try
End Sub

Outcomes