![]() |
Problem with ItemSend
I am using VS2005 and wish to record details of an e-mail send from
my app but I can't seem to update my form when the message is sent. I have a simple form with one text box (txtMessage) and a button (btnMail). Clicking btnMail fires up Outlook and when the message is sent the ItemSend and Send events do fire but the do not allow me to update my text box. The MsgBox do not display either but the do when i comment out the txtMessage lines. What am I doing wrong??? It is as if my form is not accessible programatically in the outlook event code. I am using the following code: Imports Microsoft.Practices.EnterpriseLibrary.Data Imports System.Data Imports System.Data.Common Imports Microsoft.Office.Interop.Outlook Imports Microsoft.Office.Interop Public Class frmMailTest Dim WithEvents oApp As New Outlook.Application Dim WithEvents oMsg As Outlook.MailItem Private Sub btnMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMail.Click oMsg = oApp.CreateItem(OlItemType.olMailItem) With oMsg .To = " .Subject = "Subject" .BodyFormat = OlBodyFormat.olFormatPlain .Body = "Type your message here" .Display() End With End Sub Private Sub oApp_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean) Handles oApp.ItemSend txtMessage.Text = Item.body.ToString MsgBox("Mail Sent") End Sub Private Sub oMsg_Send(ByRef Cancel As Boolean) Handles oMsg.Send txtMessage.Text = oMsg.Body.ToString MsgBox("Mail Sent") End Sub End Class |
All times are GMT +1. The time now is 12:26 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com