spider5
路人甲
路人甲
  • 注册日期2005-05-01
  • 发帖数6
  • QQ
  • 铜币118枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1456回复:1

mo2.3有bug么?

楼主#
更多 发布于:2005-10-17 12:16
<P>试用mo2.3(已破解)</P>
<P>载入了一个帮助文件里的例子,代码如下</P>
<P>Option Explicit</P>
<P>Private Sub Command1_Click()<br>  Dim strFileTitle As String, sDataSetName As String<br>  Dim sFileDirectory As String<br>  Dim dc As New MapObjects2.DataConnection<br>  Dim lyr As New MapObjects2.MapLayer<br>  <br>  CommonDialog1.Filter = "Shapefiles (*.shp)|*.shp"<br>  CommonDialog1.ShowOpen<br>  <br>  strFileTitle = CommonDialog1.FileTitle 'just the name with the shp extension<br>  <br>  If strFileTitle <> "" Then<br>    <br>    With CommonDialog1<br>      sFileDirectory = Left$(.FileName, InStr(.FileName, .FileTitle) - 1)</P>
<P>    End With<br>        <br>    With dc<br>      .Database = sFileDirectory 'the directory containing the selected file<br>  <br>      If .Connect Then<br>        sDataSetName = Mid(strFileTitle, 1, Len(strFileTitle) - 4) 'remove the extension<br>        Set lyr.GeoDataset = dc.FindGeoDataset(sDataSetName)<br>        Map1.Layers.Add lyr<br>      Else<br>        MsgBox "Data Connection error #" ; dc.ConnectError, vbExclamation<br>      End If<br>    End With<br>    <br>  End If<br>  <br>  Set dc = Nothing</P>
<P>  Set lyr = Nothing</P>
<P>End Sub</P>
<P>运行时发现,如果把shape文件放在某个目录下,会出现错误"valid object expected as argument",只有放在根目录下才能正确载入,这个问题怎么解决呢?</P>
<P><img src="images/post/smile/dvbbs/em28.gif" /><img src="images/post/smile/dvbbs/em30.gif" /></P>
[此贴子已经被作者于2005-10-17 12:21:48编辑过]
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-11-07 10:39
不要用中文名看看能行否
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部