MessageReceived

  • Thread starter Thread starter Tym
  • Start date Start date
Hi,

It exists :
MessageInterceptorEventHandler Represents the method that will handle
the MessageReceived event.

sms = new MessageInterceptor();
sms.MessageReceived += new
MessageInterceptorEventHandler(sms_MessageReceived);

I think yes, but did you add a reference to
Microsoft.WindowsMobile.PocketOutlook.

BR


Fabien Decret
Windows Embedded Consultant


ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/
 
Hi,

I have the reference already


Public Class MainForm
Private networkConnectionState As SystemState
Private cradleState As SystemState
Private SMS As MessageInterceptor
'Public Event MessageReceived As MessageInterceptorEventHandler


Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuItem2.Click
Application.Exit()

End Sub

Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load


SMS.InterceptionAction = InterceptionAction.NotifyAndDelete
SMS.MessageCondition = New
MessageCondition(MessageProperty.Body,
MessagePropertyComparisonType.StartsWith, "TEXT HERE")

SMS = New MessageInterceptor
***SMS.MessageReceived*** += New
MessageInterceptorEventHandler(***sms_MessageReceived***)


End Sub


End Class


The bits between ***...*** are blue underlined...
Error 1 'Public Event MessageReceived(sender As Object, e As
Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessageInterceptorEventArgs)'
is an event, and cannot be called directly. Use a 'RaiseEvent'
statement to raise an event. C:\E\VB98\VB.Net Projects\Form1.vb 26
9

Error 2
'Microsoft.WindowsMobile.PocketOutlook.MessageInterception.MessageInterceptorEventHandler'
is a delegate type and requires a single 'addressof' expression as the
only argument to the constructor. C:\E\VB98\VB.Net
Projects\Form1.vb 26 67


If I type SMS. the only autocomplete option given to me that starts
message is messagecondition.

Please advise
 
Hi,

In VB to add a handler to an event, you must use the keyword
AddHandler and AddressOf.

AddHandler m_Receiver.MessageReceived, AddressOf
m_Receiver_MessageReceived

Check out on MSDN site.


BR


Fabien Decret
Windows Embedded Consultant


ADENEO (ADESET)
http://www.adeneo.adetelgroup.com/
 
Thanks - I'm new to VB.Net.... been playing with vb6 for a few years -
not gone that far into it

Tym
 
Back
Top