Obtain selectionset from table
Tablewindow object allows you to obtain the selected row. The following example shows how to obtain the selection object through the selectionset attribute of itablewindow.
Public sub gettableselection ()
dim pmxdoc as imxdocment
set pmxdoc = thisdocument
'use the itablecollection interface on the map to get at all tables in the current data frame
dim ptablecollection as itablecollection
set ptablecollection = pmxdoc. focusmap
If ptablecollection. tablecount 1 then
msgbox "there are no tables in the active data frame ", vbexclamation
exit sub
end if
'get the first table from the collection
dim ptable as itable
set ptable = ptablecollection. table (0)
Dim ptabwin as itablewindow
Dim poldwin as itablewindow
Set ptabwin = new tablewindow
'Check to see if the table windwo is already open
Set poldwin = ptabwin. finviatable (ptable, false)
If not poldwin is nothing then
Set ptabwin = poldwin
Else
Set ptabwin. Table = ptable
Set ptabwin. Application = Application
'Allow one selected row
Ptabwin. tableselectionaction = esriselectcurrentrow
Ptabwin. Show true
End if
'Get the selectionset
Dim pselset as iselectionset
Set pselect = ptabwin. selectonset
'Use the selectionset property on itablewin to get the selected records
'Show the Count of selected records in a message box
Msgbox "the table has" & pselset. Count & "selected records"
End sub