VB.NET+MAPX
查询问题 Dim FindObj As MapXLib.Find Dim FoundFeature As MapXLib.FindFeature ''从要
查询的RTU图层
生成Find对象,并为这个对象设置要
查询的FindDataSet、FindField
属性 FindObj = AxMap1.Layers.Item(1).Find FindObj.FindDataset = AxMap1.DataSets(Me.Combo
Box2.Text & "dataset ") ''( "RTU节点 " & " dataset ") FindObj.FindField = FindObj.FindDataset.Fields(Me.Combo
Box2.Text) ''( "RTUName ") FoundFeature = FindObj.Search(Combo
Box1.Text) Me.Hide() '' 关掉AutoRedraw是因为CenterX(Y)的改变就要刷新图层,AutoRedraw打开的话会造成二次刷新 AxMap1.AutoRedraw = False Me.Show() -------------------------------------------- 编译通过后 Me.Combo
Box2.Text 中输入图层名 Combo
Box1.Text中输入
内容 “FindObj.FindDataset = AxMap1.DataSets(Me.Combo
Box2.Text & "dataset ")”这行总是
提示 “No object was found using the index you specified.” 请问是怎么了? __________________________________________________________________________ 没人知道吗? __________________________________________________________________________ 谁知道告诉小弟啊 __________________________________________________________________________ AxMap1.DataSets之前add过么? 你的
代码有问题,觉得你至少也要写成axmap1.datasets.item()什么的吧? __________________________________________________________________________ 所有
代码是: Dim lyR As MapXLib.Layer Dim findobj As MapXLib.Find Dim findStr As String Dim i As Short Dim fdat As MapXLib.FindFeature Dim layerds As MapXLib.Dataset Dim fid As MapXLib.Field On Error Resume Next TreeView1.Nodes.Clear() Dim result As Integer ''数据绑定 For Each lyR In AxMap1.Layers AxMap1.DataSets.Add(MapXLib.DatasetTypeConstants.miDataSetLayer,lyR,lyR.Name) Next lyR findStr = Text
Box1.Text.Trim ''输入
查询目标 " Dim X As MapXLib.Field ''Field
查询字段,和find.DataSets
属性一起使用 For i = 1 To AxMap1.Layers.Count ''
查询每一层 findobj = AxMap1.Layers(i).Find ''查找的对象是第*层 layerds = AxMap1.DataSets.Item(AxMap1.Layers(i).Name) ''
查询数据集Item(列名) findobj.FindDataset = Me.AxMap1.DataSets(AxMap1.Layers(i).Name) ''FindDataset
查询数据集 For Each fid In layerds.Fields findobj.FindField = findobj.FindDataset.Fields(fid) ''Field
查询字段 fdat = findobj.Search(findStr) ''AxMap1.CenterX = fdat.CenterX ''AxMap1.CenterY = fdat.CenterY AxMap1.Layers(i).Selection.se.Replace(fdat) ''
添加网格表示选取(高亮) '' AxMap1.Layers(i).ClearSelection() Next fid Next ''If fdat = " " Then Msg
Box( "没有找到任何数据! ","
提示 ") ''AxMap1.AutoRedraw = False '' (
禁止自动刷新) Me.AxMap1.DataSets.RemoveAll() -------------------------------------------- 编译通过后 Me.Combo
Box2.Text 中输入图层名 Combo
Box1.Text中输入
内容 “FindObj.FindDataset = AxMap1.DataSets(Me.Combo
Box2.Text & "dataset ")”这行总是
提示 “No object was found using the index you specified.” 请问是怎么了? __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263948.html