Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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[^]
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900