使用 BeginUpdate 和 EndUpdate[3]

系统架构设计师 责任编辑:lisong8627 2009-06-08

添加老师微信

备考咨询

加我微信

摘要:TreeView1.Nodes.Add(NewTreeNode(customer2.CustomerName))''AddachildTreeNodeforeachOrderobjectinthecurrentCustomer.ForEachorder1AsOrderIncustomer2.CustomerOrdersTreeView1.Nodes(Array.IndexOf(customerArray,customer2)).Nodes.Add(_NewTreeNode(customer2.CustomerName&

 

  TreeView1.Nodes.Add(New TreeNode(customer2.CustomerName))

  ' Add a child TreeNode for each Order object in the current Customer.

  For Each order1 As Order In customer2.CustomerOrders

  TreeView1.Nodes(Array.IndexOf(customerArray, customer2)).Nodes.Add( _

  New TreeNode(customer2.CustomerName & "." & order1.OrderID))

  Next

  Next

  ' Begin repainting the TreeView.

  TreeView1.EndUpdate()

 

  即使在您不希望向控件添加许多对象时,您也应该使用 BeginUpdate 和 EndUpdate 方法。在大多数情况下,您在运行之前将不知道要添加的项的确切个数。因此,为了妥善处理大量数据以及应付将来的要求,您应该总是调用 BeginUpdate 和 EndUpdate 方法。注调用 Windows 窗体控件使用的许多 Collection 类的 AddRange 方法时,将自动为您调用 BeginUpdate 和 EndUpdate 方法。

  返回目录:智能客户端体系结构与设计指南

[1]  [2]  [3]  

更多资料
更多课程
更多真题
温馨提示:因考试政策、内容不断变化与调整,本网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准!

软考备考资料免费领取

去领取

!
咨询在线老师!