How to Access the Property/Field in a custom Contact Form

G

Guest

I am writing a small program to respond to contact-Add event.

To obtain more usefule information, I used a custom contact form instead of
using the default the contact form to add contact. The custom contact form
contains an Text Control naming TextBox1. However, it seems I cannot
access this property. Following is the code snippet. I used the MsgBox to
capture the property. The default property FullName is captured very well.

Private WithEvents myContacts As Microsoft.Office.Interop.Outlook.Items

Private Sub myContacts_ItemAdd(ByVal Item As Object) Handles
myContacts.ItemAdd
Try
myItem = CType(Item, Microsoft.Office.Interop.Outlook.ContactItem)
MsgBox(myItem.FullName)
MsgBox(myItem.TextBox1)
Catch err As COMException
MsgBox("Exception in OnConnection: " & _
err.Message)
Catch err As InvalidCastException
MsgBox("Exception in OnConnection: " & _
err.Message)
End Try
End Sub
 
S

Sue Mosher [MVP-Outlook]

A control is not a property, although it may be bound to a property and thus the control's value is the same as the property's value. See http://www.outlookcode.com/d/propsyntax.htm for a primer on property and control syntax.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top