s8613004
路人甲
路人甲
  • 注册日期2004-08-15
  • 发帖数3
  • QQ
  • 铜币115枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1061回复:0

[求助]在VB中新建图层及属性的问题

楼主#
更多 发布于:2004-08-31 13:38
<P ><FONT size=3><FONT face="Times New Roman">请问为什么在宣告的时候都会出现"使用者自定型态尚未定义"这个问题!?</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">  Dim rs As DAO.Recordset <<<<
  Dim db As DAO.Database <<<<
  Dim flds As New MapXLib.Fields
  Dim lyrNew As MapXLib.Layer
  Dim ptNew As New MapXLib.Point
  Dim ftrNew As MapXLib.Feature
  Dim ff As MapXLib.FeatureFactory
  Dim li As New MapXLib.LayerInfo
  Dim rvs As New MapXLib.RowValues
  Dim ds As MapXLib.Dataset
</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">  Set db = DBEngine.OpenDatabase("C:\test\db1.mdb")
  Set rs = db.OpenRecordset("test")
  Set ff = Map1.FeatureFactory
</FONT></FONT><FONT size=3><FONT face="Times New Roman">      flds.AddStringField "Company", 50
      flds.AddStringField "City", 50
      flds.AddStringField "State", 2
      flds.AddNumericField "Order_Amt", 12, 2</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">      'define the LayerInfo object
      li.Type = miLayerInfoTypeNewTable
      li.AddParameter "FileSpec", App.Path ; "\custtab.tab"
      li.AddParameter "Name", "mycustomers"
      li.AddParameter "Fields", flds</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman"></FONT></FONT> </P>
<P ><FONT size=3><FONT face="Times New Roman">      Map1.Layers.Add li, 1
</FONT></FONT><FONT size=3><FONT face="Times New Roman">      Set lyrNew = Map1.Layers(1)
      Set ds = Map1.DataSets.Add(miDataSetLayer, lyrNew)
      Set rvs = ds.RowValues(0)
     Do While Not rs.EOF
           rvs.Item("Company").Value = rs.Fields("Company")
           rvs.Item("City").Value = rs.Fields("City")
           rvs.Item("State").Value = rs.Fields("State")
           rvs.Item("Order_Amt").Value = rs.Fields("Order_Amt")
           ptNew.Set rs.Fields("X"), rs.Fields("Y")
           Set ftrNew = ff.CreateSymbol(ptNew)
           Set ftrNew = lyrNew.AddFeature(ftrNew, rvs)
           rs.MoveNext
      Loop
  Set rs = Nothing
  Set db = Nothing
</P><p></p></FONT></FONT>
喜欢0 评分0
游客

返回顶部