Returning all columns from a table, Changing the map view following a selection – Pitney Bowes MapXtreme User Manual
Page 205

Chapter 9: Working with Core MapXtreme Classes
Selection Code Examples
MapXtreme v7.1
212
Developer Guide
VB example:
Public Shared Sub MapInfo_Engine_Selection2()
Dim session As ISession = MapInfo.Engine.Session.Current
Dim tableUsa As Table = session.Catalog("usa")
' Get fc for selection on usa.
Dim fc As IResultSetFeatureCollection = _
session.Selections.DefaultSelection(tableUsa)
Dim nCount As Integer = 0
If Not fc Is Nothing Then
nCount = fc.Count
End If
End Sub
You can also perform selection operations using MapInfo SQL queries and with the ADO.NET data
provider. See
Returning All Columns From a Table
The following sample shows how to return all columns from a selection:
VB example:
Dim Connection As MIConnection = New MIConnection
Connection.Open()
Dim lyr As FeatureLayer = MapControl1.Map.Layers("usa")
Dim ti As MapInfo.Data.Table = _
MapInfo.Engine.Session.Current.Catalog.GetTable("usa")
Dim si As MapInfo.Data.SearchInfo = _
MapInfo.Data.SearchInfoFactory.SearchAll()
si.QueryDefinition.SetColumns("*")
Dim irfc As MapInfo.Data.IResultSetFeatureCollection = _
MapInfo.Engine.Session.Current.Catalog.Search(ti.Alias, si)
Dim l As MapInfo.Data.Feature
For Each l In irfc
Dim column As MapInfo.Data.Column
For Each column In l.Columns
MessageBox.Show(column.ToString())
Next
Next
Changing the Map View Following a Selection
The following example shows how to change the zoom to display all the features in a selection.
VB example:
Me.MapControl1.Map.Bounds = _
MapInfo.Engine.Session.Current.Selections.DefaultSelection.Envelope.Bound
s