阅读:1587回复:0
Example of Find using FindField in Visual Basic
Private Sub FindTest_Click()
Dim fftrFoundObj As mapxlib.FindFeature Dim lyrUSA As mapxlib.Layer Dim dsFind As mapxlib.Dataset 'add the layer we're going to search in Set lyrUSA = Map1.Layers.Add("usa.tab") 'create a dataset from that layer Set dsFind = Map1.Datasets.Add(miDataSetLayer, lyrUSA) 'set the layer's FindDataset and FindField Set lyrUSA.Find.FindDataset = dsFind Set lyrUSA.Find.FindField = dsFind.Fields("State_Name") 'now search the layer Set fftrFoundObj = lyrUSA.Find.Search("New York") 'if a good match was found , display that feature, 'if not display the FindResult code If (fftrFoundObj.FindRC Mod 10 = 1) Then Map1.Zoom = 500 Map1.CenterX = fftrFoundObj.CenterX Map1.CenterY = fftrFoundObj.CenterY Else MsgBox "No exact match found. " + Str$(fftrFoundObj.FindRC) End If End Sub |
|
|