PropertyPageSite not set to an instance of an object - Outlook add-in - vs.net

  • Thread starter Thread starter Thomas Abraham
  • Start date Start date
T

Thomas Abraham

I posted this in microsoft.public.developer.outlook.addins
but did not get a reply

Hi,

I am using VB.NET to create an outlook addin. My control
works fine.
The only place I am having a problem with is enabling
the "apply"
button when the user changes some items on the property
page.

I do not know how to get a reference to the
PropertyPageSite so that I
can call OnStatusChange(). Here is the trimmed code:

--snip---
<GuidAttribute("xxx"), ProgIdAttribute("xxx")> _
Public Class UserOptions
Inherits System.Windows.Forms.UserControl
Implements Outlook.PropertyPage

Public Sub New()
MyBase.New()
UserControl_InitProperties()
End Sub

Private _Site As Outlook.PropertyPageSite

Private Sub UserControl_InitProperties()
Try
_Site = Parent 'NO EXCEPTION THROWN
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub


Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
_Site.OnStatusChange() 'EXCEPTION THROWN
End Sub
End Class

--snip---

The weird thing is _Site = Parent does not cause an
exception but in
the event handler _Site.OnStatusChange() raises an
exception:
System.NullReferenceException: Object reference not set to
an instance
of an object.

Any ideas on what I am doing wrong.

Thanking you in advance for your time,

-Tom
 
Back
Top