0

考虑以下方法:

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")(example = "000123456") 创建一组参数 ( GoActionEventArgs) 以传递给我的事件 ( BeginGoAction)。直到此时r.Cells("item_id")仍然存在并包含值。

    If action.equals("Go") Then
        RaiseEvent BeginGoAction(action, New GoActionEventArgs(Me.Scope, r.Cells("item_id").Value.ToString))
    End If

2)在事件被触发并且与该事件相关的所有动作都被执行之后,程序应该开始一个工作流。允许跨不同应用程序完成操作。因此它需要item_iditem_type存储在我的r.Cells. 除了突然之间R.Cells.Count() = 0,它不再包含item_iditem_type

StartMyWorkFlow(r.Cells("item_id").Value.ToString, CStr(r.Cells("item_type").Value))

问题: 如何仅仅因为一个事件被触发而r.Cells从包含值(item_id, item_type,...)变成一个空集合?r.Cells由于该事件对其所在的网格或网格没有影响r

请注意,这是基于现有代码的伪代码。如有错别字请见谅...

注意 2:该事件不会清除(或与)网​​格(或与网格有任何交互)。它对不同的 web 服务/数据库执行一组微妙的操作。代码太长(所有方法组合),无法在此处发布。

额外信息:

构造函数 GoActionEventArgs:

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

事件 BeginGoAction:

Public Event BeginGoAction(ByVal actionName As String, ByVal args As GoActionEventArgs)
4

0 回答 0