Click here to Skip to main content
15,881,791 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a windows forms vb.net project.
I want the same project in wpf. Can I use the windows forms in wpf application?
If yes then how?
Posted

Hi,

You can use a WindowsFormsHost to host a Windows Forms control on a WPF form.
First, add a reference to WindowsFormsIntegration.dll and then use a WindowsFormsHost:
http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx[^]
http://msdn.microsoft.com/en-us/library/ms742875.aspx[^]
But you can't convert a Windows Forms application to a WPF application, unless you convert it manually, because WPF and Windows Forms are very different.

Hope this helps.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 1-Jul-13 13:26pm    
5ed. I added just one good reference as I usually do, please see.
—SA
Thomas Daniels 1-Jul-13 13:27pm    
Thank you!
Espen Harlinn 2-Jul-13 10:40am    
5'ed!
Thomas Daniels 2-Jul-13 12:15pm    
Thank you!
In addition to Solution 1: use this Microsoft walkthrough article: http://msdn.microsoft.com/en-us/library/ms751761.aspx[^].

But first of all, consider using either WPF along or Forms along. These two libraries have very different nature, one using DirectX and having very little to do with Windows, another one fully based on Windows API and GDI+; interop between them is extremely complex.

—SA
 
Share this answer
 
Comments
Thomas Daniels 1-Jul-13 13:27pm    
Good answer, my 5!
Sergey Alexandrovich Kryukov 1-Jul-13 13:27pm    
Thank you.
—SA
Espen Harlinn 2-Jul-13 10:41am    
5'ed!
Sergey Alexandrovich Kryukov 2-Jul-13 11:31am    
Thank you, Espen.
—SA

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