首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

用vb6写个类,实现点的加入、删除、获得点个数。请帮忙!解决方案

2012-01-13 
用vb6写个类,实现点的加入、删除、获得点个数。。。,请帮忙!我用vb6写个实现点的加入、删除、获得个数的简单类,怎

用vb6写个类,实现点的加入、删除、获得点个数。。。,请帮忙!
我用vb6写个实现点的加入、删除、获得个数的简单类,怎么编译可以,用的时候错误
代码如下?:
Public   count   As   Integer
Dim   x()   As   Double
Dim   y()   As   Double
Dim   z()   As   Double

Public   Sub   delete(pos   As   Integer)
      If   count   >   0   Then
          If   pos   <   count   Then
              For   i   =   pos   To   UBound(x)   -   1
                  x(i)   =   x(i   +   1)
                  y(i)   =   y(i   +   1)
                  z(i)   =   z(i   +   1)
              Next
              count   =   count   -   1
          End   If
      End   If
End   Sub

Public   Sub   clear(ncount   As   Integer)
    Erase   x
    Erase   y
    Erase   y
      count   =   0
End   Sub

Public   Function   add(a   As   Double,   b   As   Double,   c   As   Double)
    ReDim   x(UBound(x)   +   1)   As   Double
    ReDim   y(UBound(y)   +   1)   As   Double
    ReDim   z(UBound(z)   +   1)   As   Double
    x(UBound(x))   =   a
    y(UBound(y))   =   b
    z(UBound(z))   =   c
    count   =   UBound(x)
End   Function

Private   Sub   Class_Initialize()
    count   =   0
    ReDim   x(1)   As   Double
    ReDim   y(1)   As   Double
    ReDim   z(1)   As   Double
    x(0)   =   0
    y(0)   =   0
    z(0)   =   0
End   Sub

Private   Sub   Class_Terminate()
    Erase   x
    Erase   y
    Erase   y
End   Sub


[解决办法]
dim mylist as ptlist
set mylist = new ptlist <-
mylist.add 21,23,12

热点排行