[VB.NET]VB.NET+MAPX查询问题
2008-12-27 21:24
176 查看
<script type="text/javascript"><!--
google_ad_client = "pub-8333940862668978";
/* 728x90, 创建于 08-11-30 */
google_ad_slot = "4485230109";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
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.ComboBox2.Text & "dataset ") ''( "RTU节点 " & " dataset ")
FindObj.FindField = FindObj.FindDataset.Fields(Me.ComboBox2.Text) ''( "RTUName ")
FoundFeature = FindObj.Search(ComboBox1.Text)
Me.Hide()
'' 关掉AutoRedraw是因为CenterX(Y)的改变就要刷新图层,AutoRedraw打开的话会造成二次刷新
AxMap1.AutoRedraw = False
Me.Show()
--------------------------------------------
编译通过后
Me.ComboBox2.Text 中输入图层名
ComboBox1.Text中输入内容
“FindObj.FindDataset = AxMap1.DataSets(Me.ComboBox2.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 = TextBox1.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 MsgBox( "没有找到任何数据! ", , "提示 ")
''AxMap1.AutoRedraw = False '' (禁止自动刷新)
Me.AxMap1.DataSets.RemoveAll()
--------------------------------------------
编译通过后
Me.ComboBox2.Text 中输入图层名
ComboBox1.Text中输入内容
“FindObj.FindDataset = AxMap1.DataSets(Me.ComboBox2.Text & "dataset ")”这行总是提示 “No object was found using the index you specified.”
请问是怎么了?
__________________________________________________________________________
相关文章推荐
- [VB.NET]请大家帮忙看看,多条件查询的问题
- vb.net 下的sql多表查询问题
- [VB.NET]请教:数据库逆向查询问题
- VB.NET ACCESS数据库SQL查询使用时间的问题
- vb.net中对于ORACLE的时间查询问题
- VB.NET的一个小问题
- VB.NET+三层 机房收费系统之组合查询
- vb.net 中最小化到托盘和锁定窗体大小的问题(notifyIcon的两个重要属性)
- VB.NET2005 AxWindowsMediaPlayer1连续播放问题解决
- 解决VB.net使用COM控件加载Excel文件速度慢的问题
- VB.net使用多线程与委托解决时间延迟的问题
- VB.NET & (三层+泛型)实现组合查询
- VB.Net使用CInt转型非整数值时需要注意的问题
- 章鱼哥出品—VB.NET DataGridView绑定数据源 "与货币管理器的位置关联的行不能设置为不可见" 问题的解决
- 迁移到 ASP .NET:需考虑的重要问题(VB.net)
- VB查询数据库用于Ext.NET的Store
- VB.NET机房重构问题点滴积累
- VB.NET 中的DataGrid自动换行问题
- VB.NET写的DLL调用问题
- 学习VB.NET编程最基本的三个问题