What's the equivalent in C# of this VB code on an Outlook form?

Posted by wes on Stack Overflow See other posts from Stack Overflow or by wes
Published on 2011-01-03T22:26:42Z Indexed on 2011/01/04 21:53 UTC
Read the original article Hit count: 201

Filed under:
|
|

Basically, how do I link an Outlook form and a C# back end? In VB you can write on the form

Sub ButtonName_Click()
    Dim Recipients

    With Item.GetInspector.ModifiedFormPages("Message")
        Set Recipients = .Controls("To")
    End With
End Sub

which will fire whenever the button named "ButtonName" on the form is clicked and will set the variable Recipients to a string of whatever is in the To text box.

Now I have a custom form, and I have a VS C# Outlook Add-in, and they're two separate things. I've got an event handler that can catch MailItem objects, but I don't know how to handle custom form button clicks or even how to access elements on the form.

EDIT - Just to clarify, the custom form was created in Outlook and then its .ofs was imported into VS. Both Outlook and VS are 2010.

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb