Example: Get selectionset from table

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.