jesse8013
路人甲
路人甲
  • 注册日期2006-04-01
  • 发帖数2
  • QQ
  • 铜币107枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1189回复:1

[原创]求助一个菜鸟的问题

楼主#
更多 发布于:2006-04-08 23:28
<P>  我在看GettingStartedinVB 的时候,我照着上面的代码 写查询 的时候出了个错误</P>
<P>哪为麻烦帮我看看</P>
<P>Private Sub Command1_Click()<BR>Dim i As Integer<BR>Dim pFeatLyr As IFeatureLayer<BR>For i = 0 To MapControl1.LayerCount - 1<BR>Set pFeatLyr = MapControl1.Layer(i)<BR>If pFeatLyr.Name = "states" Then<BR>' Found it and exit loop<BR>Exit For<BR>End If<BR>Next i<BR>' Create a string to use in the query<BR>Dim queryStr As String<BR>queryStr = "STATE_NAME = '" ; Text1.Text ; "'"<BR>' Create the query filter<BR>Dim pQueryFltr As IQueryFilter<BR>Set pQueryFltr = New QueryFilter<BR>pQueryFltr.WhereClause = queryStr<BR>' Perform the selection<BR>Dim pFeatSeln As IFeatureSelection<BR>' QI for IFeatureSelection from the<BR>' IFeatureLayer<BR>Set pFeatSeln = pFeatLyr<BR>pFeatSeln.SelectFeatures , pQueryFltr, esriSelectionResultNew, False<BR>' Get the selection set<BR>Dim pSelSet As ISelectionSet<BR>Set pSelSet = pFeatSeln.SelectionSet<BR>' Get the cursor from the selection set<BR>Dim pFeatCursor As IFeatureCursor<BR>pSelSet.Search Nothing, True, pFeatCursor<BR>' Assume only one feature<BR>Dim pFeature As IFeature<BR>Set pFeature = pFeatCursor.NextFeature<BR>If Not pFeature Is Nothing Then<BR>' Get the extent of the selected feature<BR>Dim pExtent As IEnvelope<BR>Set pExtent = pFeature.Shape.Envelope<BR>' And set the Map control's extent<BR>MapControl1.Extent = pFeature.Shape.Envelope<BR>End Sub</P>
<P>我在点查询的 时候出的错误如</P>
<P>compile error</P>
<P>user defind type not  defined </P>
<P>这个错误只在我进行查找操作是才会出先</P>
<P>其他都蛮正常的</P>
喜欢0 评分0
zpgis2002
路人甲
路人甲
  • 注册日期2004-10-29
  • 发帖数83
  • QQ
  • 铜币329枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-06-26 10:58
<P>看是否引用了AO和ESRI对象库.我只是揣测</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部