A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to Unregister events



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 22nd 06, 12:53 PM posted to microsoft.public.outlook.program_vba
Virda
external usenet poster
 
Posts: 13
Default How to Unregister events


Hello List,

I want to unregister some events,
When execuation code reached to the line

tems.ItemAdd -= new
Outlook.ItemsEvents_ItemAddEventHandler(this.Items _ItemAdd);

it raises exception:
"Object reference not set to an instance of an object."

I am using following code
void load()
{
Outlook.MAPIFolder Task = ns.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolder Tasks);
}

UnregisterEvent()
{
// This line throw exception , Object reference not set to an instance of an
object
items.ItemAdd -= new
Outlook.ItemsEvents_ItemAddEventHandler(this.Items _ItemAdd);
}
. . . .
. . .. .
Following piece of code exist in another class
Item_AddEvent()
{
olTaskIem -- add some UserProperty
olTaskItem.Save() // this functin raise Item Add event
TaskFolderHandler objTask = TaskFolderHandler();
objTask . UnregisterEvent();
}
. . . ..


Can anyone figure out why error is being raised, and how I overcome this
problem?

Thanks i nadvance
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
1-Day Events randomly turn into 2-Day Events MJWUSTL Outlook - Calandaring 1 August 16th 06 06:25 PM
Item open events and double click events in exchange client extension. Fanxa Add-ins for Outlook 1 August 9th 06 09:18 AM
All Day Events and Recuring events Brian Outlook - Calandaring 0 August 4th 06 03:17 PM
Custom Events Theresa Smallwood Outlook - Using Forms 0 May 9th 06 05:07 PM
Events not always triggered Jim Burke in Novi Outlook and VBA 1 January 30th 06 07:36 AM


All times are GMT +1. The time now is 08:24 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-2025 Outlook Banter.
The comments are property of their posters.