bsp; ''''现在,让我们从公司字典中获取老板的名字
''''在NOD中找到.
Dim
NOD As DBDictionary =
trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead, False)
Dim
acmeDict As DBDictionary =
trans.GetObject(NOD.GetAt("ACME_DIVISION"), OpenMode.ForRead)
''''注意我们直接使用扩展数据...
Dim
salesDict As DBDictionary =
trans.GetObject(acmeDict.GetAt(EmployeeXRec.Data.AsArray(2).Value),
OpenMode.ForRead)
Dim
salesXRec As Xrecord =
trans.GetObject(salesDict.GetAt("Department Manager"),
OpenMode.ForRead)
''''最后,把雇员的数据输出到命令行
resBuf =
salesXRec.Data.AsArray(0)
saEmployeeList.SetValue(String.Format("{0}" + ControlChars.Lf,
resBuf.Value), nEmployeeDataCount)
nEmployeeDataCount += 1
End
If
End
If
trans.Commit()
Finally
trans.Dispose()
End Try
End Sub
<CommandMethod("PRINTOUTEMPLOYEE")> _
Public Shared Function
PrintoutEmployee()
Dim ed As Editor =
Application.DocumentManager.MdiActiveDocument.Editor
Dim
nEmployeeCount As Integer
= 0
Dim
nEmployeeDataCount As Integer
''''声明我们将在下面使用的工具...
Dim db
= HostApplicationServices.WorkingDatabase
Dim
trans As Transaction =
db.TransactionManager.StartTransaction() ''''Start the
transaction.
Try
''''首先,获取块表和模型空间块表记录
Dim
bt As BlockTable =
trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId,
OpenMode.ForRead)
Dim
btr As BlockTableRecord =
trans.GetObject(bt(btr.ModelSpace), OpenMode.ForRead)
''''现在,我们需要把内容输出到命令行。这里可以有一个对象帮助我们:
''''下面的部分,我们将遍历模型空间:
Dim
id As ObjectId '''' – 首先,定义一个ObjectId对象,用于For循环。
For
Each id In btr
Dim
ent As Entity = trans.GetObject(id,
OpenMode.ForRead, False) ''''打开当前对象!
If
TypeOf ent Is
BlockReference Then
Dim
saEmployeeList(-1) As String
''''这是正确的...它被重新定义。
ListEmployee(id, saEmployeeList)
Dim
sEmployeeData As String
If
(saEmployeeList.Length = 4) Then
ed.WriteMessage("Employee Name: {0}", saEmployeeList(0))
ed.WriteMessage("Employee
Salary: {0}", saEmployeeList(1))
ed.WriteMessage("Employee Division: {0}", saEmployeeList(2))
ed.WriteMessage("Division Manager: {0}", saEmployeeList(3))
End
If
End If
Next
Finally
End Try
End Function
上一页 [1] [2] [3] [4] [C语言系列]NET 中C#的switch语句的语法 [系统软件]托拽Explore中的文件到VB.net的窗口 [系统软件]Boost库在XP+Visual C++.net中的安装 [常用软件]新配色面板:Paint.Net3.0RC1官方下载 [常用软件]用内建的“Net Meeting”聊天 [VB.NET程序]Henry的VB.NET之旅(三)—共享成员 [VB.NET程序]Henry的VB.NET之旅(二)—构造与析构 [VB.NET程序]Henry的VB.NET之旅(一)—失踪的窗体 [VB.NET程序]在托盘上显示Balloon Tooltip(VB.NET) [VB.NET程序]Henry手记-VB.NET中动态加载Treeview节点(二)
|