Problem: An ISelectionSet may not initially be assigned a value after the ISelectionEvents::SelectionChanged event is fired

文章编号 : 34267
软件: ArcGIS - ArcEditor 9.2, 9.3, 9.3.1, 10 ArcGIS - ArcInfo 9.2, 9.3, 9.3.1 ArcGIS - ArcView 9.2, 9.3, 9.3.1 ArcGIS Engine Developer Kit 9.2, 9.3, 9.3.1, 10 ArcGIS Engine Runtime 9.2, 9.3, 9.3.1, 10
操作系统: N/A
已邀请:

易智瑞技术支持

赞同来自:

错误信息: 从ArcGIS9.2开始,当给定的选择集发生变化时,将有多个事件被激活:清除当前选择集,另一个是新选择集被创建。因此,开发者在处理选择集改变时会偿试着去获取改变成的选择集,这种情况就会发生错误。
原因: 这是产品本身设计的问题。

解决方法:
为了避免这个错误的发生,在事件发生获取之前的选择集时,先确认该选择集是否为空。ArcObjects的开发人员应在读或写之前初始化该变量。以下是一个VB6的例子:
[Visual Basic 6.0] ' Respond to selection events Private Sub m_pSelectionEvents_SelectionChanged() If m_pMap Is Nothing Then Exit Sub ' no map exit... If m_pMap.SelectionCount = 0 Then Exit Sub ' no selection nothing to do... MsgBox m_pMap.SelectionCount & " feature(s) are selected." End Sub


创建时间:2008-03-01
最近更新: 2011-05-03


原文链接
http://support.esrichina.com.c ... .html

要回复问题请先登录注册