Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
GIS by ESRI ™
The names of other companies and products herein are trademarks or registered trademarks of their respective trademark owners.
MapControl icon
MapControl
icon
11
13
15
17
The sample data used in this 7. Press F4 to display the properties window, then clear the text property of the text box.
example can be found in the 8. Double-click the TextBox to display the code window.
following location of your
9. Select the Text1 KeyPress event from the right-hand dropdown list.
ArcGIS installation:
10. Add the following code to the Text1 KeyPress procedure:
\\arcgis\arcexe82\ArcObjects
Developer Kit\ Private Sub Text1_KeyPress(KeyAscii As Integer)
Samples\Data\Usa If the return key has been pressed
The code locates the states If KeyAscii = vbKeyReturn Then
layer and defines a simple SQL
Dim i As Integer
query expression using the text
in the text box. The states Dim pFeatureLayer As IFeatureLayer
layers IFeatureSelection uses Loop through the MapControl layers to find the States layer
this query to search for the
For i = 0 To MapControl1.LayerCount - 1
specified value and return the
first matching record. The Set pFeatureLayer = MapControl1.Layer(i)
extent of the MapControl is set If pFeatureLayer.Name = states Then
to the extent of the selected
Exit For
features geometry.
End If
Next i
Create a query string
Dim sQuery As String
sQuery = STATE_NAME = & Text1.Text &
Create the query filter
Dim pQueryFilter As IQueryFilter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = sQuery u
19
21
23
25