Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
' Variables declarations
Dim ANBLS As String = Me.ComboBox1.Text.Trim
Dim pMap As IMap = My.ArcMap.Document.ActiveView
Dim queryFilter As String = "FileNumber = '" + ANBLS + "'"
Dim tableName As String = "CSJGISSDE.GISDATA.Subdivision_Plans_Table"
Dim pStTabColl As IStandaloneTableCollection
Dim foundTable As Integer = 0
pStTabColl = pMap
' Check if there are tables are in TOC
If pStTabColl.StandaloneTableCount <> 0 Then
' Check if Subdivision Plans table is in TOC
For i As Integer = 0 To pStTabColl.StandaloneTableCount
If (pStTabColl.StandaloneTable(i).Name = tableName) Then
MsgBox("Subdivision Plans Table found")
foundTable = 1
Exit For
End If
Next i
Else
MsgBox("No tables found")
Return
End If
' Subdivision Plans Table Not found in the TOC
If foundTable = 0 Then
MsgBox("Subdivision Plans Table Not found")
Return
End If
' If all fails...
Catch ex As Exception
MsgBox("This action cannot be done. Save your project, then restart ArcMap.")
End Try
End Sub
Solved! Go to Solution.