Sub PostButtonClickBeforeOriginal(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
Dim strError As String = ""
Try
Dim strFromLocation As String = ""
Dim strToLocation As String = ""
'this will tell us when we've reached the end of the grid
Dim te As Microsoft.Dexterity.Bridge.TableError
'get a reference to the table
Dynamics.Forms.IvTransferEntry.Tables.IvTrxWorkLine.GetFirst()
'iterate through the table
While Not te = Microsoft.Dexterity.Bridge.TableError.EndOfTable
strFromLocation = Dynamics.Forms.IvTransferEntry.Tables.IvTrxWorkLine.TrxLocation
strToLocation = Dynamics.Forms.IvTransferEntry.Tables.IvTrxWorkLine.TransferToLocation
If strFromLocation = "myBadLocation" Then
e.Cancel = True
MsgBox("Invalid location 'myBadLocation' used, POST cancelled")
Exit Sub
End If
'increment to the next line
'te will indicate if we're at the end
te = Dynamics.Forms.IvTransferEntry.Tables.IvTrxWorkLine.GetNext()
End While
'if nothing bad happens, the POST will continue
Catch ex As Exception
'error handling code here
End Try
End Sub