Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 735
  • Last Modified:

VB.net Embed Windows form in a Custom Task Pane

Hi

Is it possible to embed  a Windows form in a Custom Task Pane?
0
Murray Brown
Asked:
Murray Brown
  • 5
  • 4
  • 2
  • +1
1 Solution
 
nepaluzCommented:
Me.Form2.Parent = MyCustomTaskPane
0
 
Jacques Bourgeois (James Burger)Commented:
Although many thinks the contrary, a Form is actually a Control. You can use a Form anywhere you use a Control (I often use Forms inside of TabControls), that is in any ContainerControl, the same way you would use a Control into it, such as the following. So, if your custom control inherits from ContainerControl or from any control that inherits from ContainerControl, you can to the following:

YourControl.Controls.Add (New yourForm)
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
*For a FORM, you need to set TopLevel() to False before you can add it to a container.  This must be done at run-time.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi. I am not sure where to put the code. I have used the example shown at the following link for my TaskPane. How would I embed Form2 inside this:
http://msdn.microsoft.com/en-us/library/bb608590.aspx
0
 
Jacques Bourgeois (James Burger)Commented:
Oh! An Outlook TaskPane. That is something else. You should have told us so. These little details are important when you ask a question.

Outlook is a COM application. It does not use .NET controls, but ActiveX controls that uses other standards.

Microsoft designed Visual Studio .NET to let you write code that can work with ActiveX controls, but you cannot insert .NET controls (a Form is a .NET control as explained before) inside of an ActiveX (Outlook, Word, Excel and many others) application.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Its an Excel TaskPane, I think that article is aimed at Excel and Outlook: "Applies to: The information in this topic applies to application-level projects for the following applications: Excel 2007 and Excel 2010; InfoPath 2007 and InfoPath 2010; Outlook 2007........
0
 
Jacques Bourgeois (James Burger)Commented:
If you go to the article and look at the left pane, you see that it is under the Office UI Customization.

You can use .NET code to manipulate Office, but you cannot use .NET controls for the Office interface because none of the Office applications are .NET, they are all COM applications.

When the article talks about addind controls to the TaskPane, they are from the Office Ribbon Controls, which are not the same type of controls the ones in then Windows.Forms namespace in which the Form is defined.

What you want to do is thus impossible. It like asking to put a Ford motor in a horse. The horse came before the car, so you cannot put a motor inside a horse. You could put a horse inside of a truck however. Same thing here. .NET can work with COM (Office), but not the reverse.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks for the clarification. Much appreciated
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I'm definitely not an Office developer, but following the links it appears to me that you can develop a .Net UserControl that can then be embedded in an Office Custom Task Pane:
http://msdn.microsoft.com/en-us/library/aa942861.aspx

Also, see "Custom Task Panes Overview":
http://msdn.microsoft.com/en-us/library/aa942864.aspx

    "Windows Forms Support - The user interface of a custom task pane that you create by using the Office development tools in Visual Studio is based on Windows Forms controls. You can use the familiar Windows Forms Designer to design the user interface for a custom task pane. You can also use the data binding support in Windows Forms to bind a data source to controls on the task pane."

    "Creating the User Interface - All custom task panes that are created by using the Office development tools in Visual Studio contain a UserControl object. This user control provides the user interface of your custom task pane. You can create the user control at design time or at run time. If you create the user control at design time, you can use the Windows Forms Designer to construct the user interface of your task pane."
0
 
Jacques Bourgeois (James Burger)Commented:
Reading the documentation in the links provided by Idle_Mind seem to point to the fact that I was wrong.

It looks as if they did something special for the CustomTaskPane that did not exist when I did .NET development with Office 2003, where only the TaskPaneControl (not the CustomTaskPane) was available.

I never saw anywhere that you could include a .NET control in a COM application, and I have searched often for that possibility. My hunch is that the CustomTaskPane is not integrated into the Officce application. It might hover over the Office application and "follow" the standard TaskPaneControl through low-level hooks to the Office application, a technique similar to the one that is often used to enhance a grid with a type of cell that it does not provide.

A UserControl is a small Form missing a few features such as the title bar and the control buttons. What you wanted to do with a Form should be possible with a UserControl. And according to Idle_Mind references, this is the way to work with the CustomTaskPane.

You should transfer the points to Idle_Mind if there is a way to do so.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi. I have requested that question be reopened. Perhaps some light could be shed on a similar sort of question
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_27664118.html#a37818578

Thanks
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now