Hi,
I have got an infopath form with VB code, and i am trying to stop the sign event if a user is not part of a particular role.
here is my code:
Public Sub FormEvents_Sign(ByVal sender As Object, ByVal e As SignEventArgs)
' This event handler will run only in fully trusted form templates.
' To add other pieces of information to sign, modifying the
' signature template returned by
' thisSignature.SignatureBlockXmlNode.
' Write your code here.
Dim userrole As String = Me.UserRole
If e.SignedDataBlock.Name = "ICTManagerSignature" Then
If userrole = "ICT manager" Then
' Dim thisSignature As Signature = e.SignedDataBlock.Signatures.CreateSignature
' thisSignature.Sign()
' e.SignatureWizard = False
Else
MessageBox.Show("Only ICT Manager can sign this box", "unable to sign", MessageBoxButtons.OK)
End If
End If
End Sub
Notice that the thisSignature.Sign() is commented out, but the form will still continue and allow the user to sign the form??!!
at first i though it may be a problem with my IF statement that was not working for whatever reason, so i decided to test by commenting out the sign() method. got a shock when it was still able to sign the form.
Any ideas???
Thanks,
Craig.