Reputation: 1587
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. I have since redesigned the form in VS.
Upvotes: 0
Views: 309
Reputation: 33089
Name
on the form. This will generate a handler for the default event which happens to be "click" in this case. It will generate a method named buttonName_Click
.recipients
in your class of type string
: private string recipients
.buttonName_Click
assign to recipients
as appropriate.In order to know exactly what code to write in the handler, I'll need to know what type of add-in this is. Most likely, the C# code will look something like:
recipients = this.Item.GetInspector().ModifiedFormPages["Message"].Controls["To"];
Upvotes: 1