Use of Additional Controls on custom forms/VSTO add-in

N

nalpakj

I'm designing a custom form and I really need the ability to display
data in a grid-type control. The data I'm displaying is not coming
from outlook, but from an external database.

The problem is that I'm not sure how to get access to these controls
from the VS.Net code. It's easy enough to access the Controls
collection of the user form and cast it to controls in the
Microsoft.Office.Interop.Outlook namespace but I seem to get errors
when I try to cast it to other controls (ie: MSFlexGrid) the cast
fails and the return value is null instead of a reference to the
control.

To be clear, I dropped an MSFlexGrid onto a custom form. I then had
code similar to the snippit below in my add-in:

private AxMSFlexGridLib.AxMSFlexGrid flexGrid;
flexGrid = UserForm.Controls.Item("MSFlexGrid1") as
AxMSFlexGridLib.AxMSFlexGrid;

The value of flexGrid is null after those lines execute.

So..questions:

1. Can I use controls other than those in the Microsoft.Office
namespace?
2. Specifically, what grid controls are available to be used?
 
S

Sue Mosher [MVP-Outlook]

This is on an Outlook legacy custom form? An Outlook 2007 form region? A Windows form?

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

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

nalpakj

Sorry, this is Outlook 2007 form region.

Can I use a Windows form in the same manner as a region? I was under
the impression I had to use regions if I want the form to be part of
the main outlook window, and Windows forms only if I'm creating a new
window.
 
S

Sue Mosher [MVP-Outlook]

1. Can I use controls other than those in the Microsoft.Office
The only controls you can use on a custom form region are ActiveX controls. There's no particular known restriction, but also there probably hasn't been a lot of testing of different controls in that environment.
Can I use a Windows form in the same manner as a region? I was under
the impression I had to use regions if I want the form to be part of
the main outlook window, and Windows forms only if I'm creating a new
window.

That's exactly right.
--
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