谁来帮我看看这段代码出了什么问题!!
Public Class Form1Dim AutoCADApp As Object
Dim Thisdrawing As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If AutoCADApp Is Nothing Then
If Err.Number <> 0 Then Err.Clear()
AutoCADApp = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then
Err.Clear()
Exit Sub
End If
Else
Thisdrawing = AutoCADApp.ActiveDocument()
'创建组
'**************************************************************************
Dim ObjGroup As Object
Dim Objentity() As Object
Dim InserMText As Object
ObjGroup = Thisdrawing.Groups.Add("*")
ReDim Objentity(0 To 3)
'**************************************************************************
Dim pt(0 To 2) As Double
With Thisdrawing.ModelSpace
For i = 0 To 3
pt(0) = 1 : pt(1) = 2 * i : pt(2) = 0
InserMText = .AddText(i, pt, 1)
Objentity(i) = InserMText
Next
ObjGroup.AppendItems(Objentity)
End With
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AutoCADApp = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then
Err.Clear()
Exit Sub
End If
End Sub
End Class
运行到这句话就报警ObjGroup.AppendItems(Objentity)
http://bbs.mjtd.com/forum.php?mod=image&aid=81517&size=300x300&key=4e6199e3f852dbcf&nocache=yes&type=fixnone
我觉得我很不了解VB.net的object对象!!谁能深入讲解一下吗?
页:
[1]