Most likely you are getting an InvalidOperation exception which is actually being thrown because of an inner exception with the following message:
Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.The FaxStatus event fires from a background thread and therefore, being on a separate thread from the user interface, cannot be used to update the controsl on the UI. This is something we may correct in future releases of FaxMan SDK. But for now here's a workaround:
1. Modify the FaxStatus event to use BeginInvoke:
Private Sub faxMan1_FaxStatus(ByVal sender As Object, ByVal args
As DataTech.FaxManNet.FaxEventArgs)
frmModemStatus.UpdateStatus(args.Fax)
If InvokeRequired Then
Dim aArray(1) As Object
aArray(0) = args.Fax.Port.ToString()
aArray(1) = args.Fax.FaxStatus.ToString()
BeginInvoke(New MyDelegate(AddressOf
UpdateStatusDisplay), aArray)
End If
Try
TextBox1.Text = args.Fax.Port.ToString()
TextBox2.Text = args.Fax.FaxStatus.ToString()
Catch ex As Exception
System.Diagnostics.Debug.WriteLine("ex = " &
ex.ToString())
End Try
End Sub
2. Define a new delegate:
Delegate Sub MyDelegate(ByVal faxPort As String, ByVal faxStatus
As String)
3. Create the callback method referenced in the BeginInvoke method:
Private Sub UpdateStatusDisplay(ByVal faxPort As String, ByVal
faxStatus As String)
TextBox1.Text = faxPort
TextBox2.Text = faxStatus
End Sub