.net 事件:找不到密钥“;参数名称";收藏
考虑以下方法:.net 事件:找不到密钥“;参数名称";收藏,.net,vb.net,events,byval,.net,Vb.net,Events,Byval,考虑以下方法: Protected Sub DoSomethingStupid(ByVal r As UltraGridRow, ByVal action As String) If action.equals("Go") Then 'item_id still exists in r.Cells RaiseEvent BeginGoAction(action, New GoActionEventArgs(Me.Scope, r.Cells("item
Protected Sub DoSomethingStupid(ByVal r As UltraGridRow, ByVal action As String)
If action.equals("Go") Then
'item_id still exists in r.Cells
RaiseEvent BeginGoAction(action, New GoActionEventArgs(Me.Scope, r.Cells("item_id").Value.ToString))
End If
'Error Occurs Here: item_id & item_type don't exist anymore in r.Cells
StartMyWorkFlow(r.Cells("item_id").Value.ToString, CStr(r.Cells("item_type").Value))
End Sub
流量:
(一)
如果action==“Go”
,则程序应使用r.Cells(“item_id”)
(example=“000123456”)创建一组参数(GoActionEventArgs
)传递到我的事件(BeginGoAction
)。直到此时,r.Cells(“item\u id”)
仍然存在并包含值
If action.equals("Go") Then
RaiseEvent BeginGoAction(action, New GoActionEventArgs(Me.Scope, r.Cells("item_id").Value.ToString))
End If
(二)
触发事件并执行与此事件链接的所有操作后,程序应启动工作流。允许跨不同的应用程序完成操作。因此它需要item\u id
和item\u type
存储在myr.Cells
中。除了所有突然出现的R.Cells.Count()=0
之外,它不再包含item\u id
和item\u type
StartMyWorkFlow(r.Cells("item_id").Value.ToString, CStr(r.Cells("item_type").Value))
问题:
仅因为触发了事件,r.Cells
如何从包含值(item\u id
,item\u type
,…)更改为空集合?因为该事件对r.Cells
或r
所在的网格没有影响
注意这是基于现有代码的psuedo代码。请原谅我的打字错误
注2:事件未清除网格(或与网格有任何交互)。它对不同的Web服务/数据库执行一组微妙的操作。它的代码太长(所有方法组合在一起),无法在此处发布
额外信息:
构造函数GoActionEventArgs:
Public Sub New(ByVal scope As EventScope, ByVal item_id As String)
MyBase.New(scope, item_id )
End Sub
事件开始行动:
Public Event BeginGoAction(ByVal actionName As String, ByVal args As GoActionEventArgs)
也许你可以对你期望发生的事情和实际发生的事情给出一个恰当的解释,而不是期望我们从不完整的数据中得出结论,没有文档记录的代码实际上并不是你想要的。指针的Thnx:我已经更新了关于流和错误的实际原因的更多信息,那么也许eventhandler会清除网格?问题中仍然没有相关代码。发布因事件而包含和执行的所有代码将使其无法读取。问题是一个参数(以byval形式给出且未链接到任何其他参数)如何突然丢失其所有值?因此当
StartMyWorkFlow(r.Cells(“item_id”)…)
工作时,如果不引发事件;当您引发事件时,它不起作用,那么问题显然在其中一个事件处理程序中。