Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have to use a WindowsForm element in WPF application.I used for this purpose "WindowsFormHost" element.It works but,at runtime compiler gives me this exception ;

"Set property 'System.Windows.Forms.Integration.WindowsFormsHost.Child' threw an exception.'" although I set it;

myFormHost = new WindowsFormsHost();
myForm = new Form();
myFormHost.Child=myForm;


Thanks in advance for your replies..
Posted
Updated 11-Jul-11 1:23am
v4

Hi,

This article will help you get started - http://www.switchonthecode.com/tutorials/wpf-tutorial-using-winforms-in-wpf[^]
Another one - http://codegod.org/WebAppCodeGod/Integration-of-WinForms-in-WPF-Applications-AID405.aspx[^]
I think the controls of the Forms can be hosted in a WPF application and not the whole form but I´m not sure.

Good luck :thumbsup:
 
Share this answer
 
Use this
host = new elementhost();
wpf = new control.page1()
grid2.children.add(wpf);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900