事件:未在集合中找到密钥“参数名称”

时间:2014-04-04 07:30:59

标签: .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_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

流量

1) 如果action == "Go",则程序应使用r.Cells("item_id")(示例=" 000123456")创建一组参数(GoActionEventArgs)以传递给我的事件({{ 1}})。直到此时BeginGoAction仍然存在且包含值。

r.Cells("item_id")

2) 触发事件并执行与此事件关联的所有操作后,程序应启动工作流程。允许在不同的应用程序中完成操作。因此,我需要 If action.equals("Go") Then RaiseEvent BeginGoAction(action, New GoActionEventArgs(Me.Scope, r.Cells("item_id").Value.ToString)) End If item_id存储在我的item_type中。除了所有突然r.Cells,它不再包含R.Cells.Count() = 0item_id

item_type

问题: StartMyWorkFlow(r.Cells("item_id").Value.ToString, CStr(r.Cells("item_type").Value)) 如何才能将包含值(r.Cellsitem_id,...)更改为空集合,因为事件被触发了?因为该事件对item_typer.Cells所在的网格没有影响。

注意这是基于现有代码的伪代码。请原谅我有任何错别字......

注2:该事件清除(或与网格有任何交互)。它对不同的Web服务/数据库执行一系列微妙的操作。其代码太长(所有方法合并)在此发布。

额外信息:

构造函数GoActionEventArgs:

r

活动BeginGoAction:

Public Sub New(ByVal scope As EventScope, ByVal item_id As String)
    MyBase.New(scope, item_id )
End Sub

0 个答案:

没有答案