“工作流实例”是一种类型,不能用作表达式。错误 [英] "Workflow Instance' is a type and cannot be used as an expression. error
问题描述
将参数传递给工作流程的Vb代码..
我的表格代码如下:
$ / b
进口System.Threading
进口System.Activities
进口System.Activities.Hosting >
公共类Form1
Dim param As Dictionary(Of String,Object)
Dim wInstance As WorkflowInstance
Dim waitHandle As AutoResetEvent
Dim NetBalance As Decimal = 0
Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
试试
waitHandle = New AutoResetEvent(False)
Catch ex As Exception
MessageBox.Show(ex.Message)
结束尝试
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As Syste m.EventArgs)处理Button1.Click
尝试
param =新词典(Of String,Object )()
param.Add(AccountName,txtaccname.Text)
param.Add(AccountAddress,txtaccaddress.Text)
param.Add(OpeningBalance,Convert.ToDecimal(txtopeningbalance.Text))
如果rdDeposit.Checked那么
param.Add(TransactionType,rdDeposit.Text )
结束如果
如果rdWithdrawal.Checked那么
param.Add(TransactionType,rdWithdrawal.Text)
结束如果
param.Add(TransactionAmount,Convert.ToDecimal(txttranamount.Text))
wInstance =新的WorkflowInstance(新的WF_BankingApplication.WF_BankingApp(),param)
wInstance.OnCompleted =功能(evt)匿名方法1(evt)
wInstance.Run()
waitHandle.WaitOne()
txtnetbalance.Text = NetBalance.ToString()
Catch ex As Exception
MessageBox.Show(ex.Message)
结束尝试
结束子
私有函数AnonymousMethod1(ByVal evt As WorkflowCompletedEventArgs)作为布尔值
NetBalance = Convert.ToDecimal(evt.Outputs(NetBalance))
waitHandle.Set()
返回True
结束功能
结束课程
行显示为粗体错误。
错误是
错误1'新'不能在声明为'MustInherit'的类上使用。
i从该行删除了新的
wInstance = WorkflowI nstance(新的WF_BankingApplication.WF_BankingApp(),param)
然后错误显示为错误1'WorkflowInstance'是一种类型,不能用作表达式。
请帮帮我
i试图创建一个项目这是在链接下面
http:// www。 dotnetcurry.com/showarticle.aspx?ID=365 [ ^ ]
Vb code for passing parameter to a workflow..
my form code is give below
Imports System.Threading
Imports System.Activities
Imports System.Activities.Hosting
Public Class Form1
Dim param As Dictionary(Of String, Object)
Dim wInstance As WorkflowInstance
Dim waitHandle As AutoResetEvent
Dim NetBalance As Decimal = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
waitHandle = New AutoResetEvent(False)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
param = New Dictionary(Of String, Object)()
param.Add("AccountName", txtaccname.Text)
param.Add("AccountAddress", txtaccaddress.Text)
param.Add("OpeningBalance", Convert.ToDecimal(txtopeningbalance.Text))
If rdDeposit.Checked Then
param.Add("TransactionType", rdDeposit.Text)
End If
If rdWithdrawal.Checked Then
param.Add("TransactionType", rdWithdrawal.Text)
End If
param.Add("TransactionAmount", Convert.ToDecimal(txttranamount.Text))
wInstance = New WorkflowInstance(New WF_BankingApplication.WF_BankingApp(), param)
wInstance.OnCompleted = Function(evt) AnonymousMethod1(evt)
wInstance.Run()
waitHandle.WaitOne()
txtnetbalance.Text = NetBalance.ToString()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Function AnonymousMethod1(ByVal evt As WorkflowCompletedEventArgs) As Boolean
NetBalance = Convert.ToDecimal(evt.Outputs("NetBalance"))
waitHandle.Set()
Return True
End Function
End Class
Error occurred in line shown as bold.
the error is
Error 1 'New' cannot be used on a class that is declared 'MustInherit'.
i removed new from that line as like this
wInstance = WorkflowInstance(New WF_BankingApplication.WF_BankingApp(), param)
then the error shows as Error 1 'WorkflowInstance' is a type and cannot be used as an expression.
please help me out
i was trying to create a project which is below link
http://www.dotnetcurry.com/showarticle.aspx?ID=365[^]
推荐答案
这篇关于“工作流实例”是一种类型,不能用作表达式。错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!