Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
This is the c# sample i'm talking about.. it's from this article:
Embedding a .NET WinForms Application in an Internet Browser Using WPF

Please help me.. i need to know the Visual Basic counterpart of this code

using System.Windows.Controls;
using System.Windows.Forms.Integration;
using Fibonacci;

namespace WPFHost
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    public partial class Page1 : Page
    {
        private readonly MainForm mainForm = new MainForm();

        public Page1()
        {
            InitializeComponent();

            //Create a Windows Forms Host to host a form
            WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
            
            stackPanel.Width = mainForm.Width;
            stackPanel.Height = mainForm.Height;
            windowsFormsHost.Width = mainForm.Width;
            windowsFormsHost.Height = mainForm.Height;
          
            mainForm.TopLevel = false;

            windowsFormsHost.Child = mainForm;

            stackPanel.Children.Add(windowsFormsHost);
        }
    }
}


What I have tried:

This is so far what i've worked for..

Imports System.Windows.Controls
Imports System.Windows.Forms.Integration
Imports webtry2

Namespace WPFHost


    Partial Public Class Page1
        Inherits Page

        'Dim mainForm As webtry2.Form1
        Private ReadOnly mainForm As webtry2.Form1 = New Form1

        Public Sub New()
            'InitializeComponent()
            Dim windowsFormsHost As WindowsFormsHost = New WindowsFormsHost()
            Dim stackPanel As StackPanel = New StackPanel
            stackPanel.Width = mainForm.Width
            stackPanel.Height = mainForm.Height
            windowsFormsHost.Width = mainForm.Width
            windowsFormsHost.Height = mainForm.Height
            mainForm.TopLevel = False
            windowsFormsHost.Child = mainForm
            stackPanel.Children.Add(windowsFormsHost)
        End Sub
    End Class

End Namespace



Im hoping for response. Thank you!
Posted
Updated 9-Sep-18 17:21pm
v2
Comments
CHill60 5-Sep-18 5:14am    
Who are you talking to?
Richard MacCutchan 5-Sep-18 5:14am    
Who exactly is this message directed at?
foxCodex 5-Sep-18 20:43pm    
Sorry im new here and i explored the profile of the man who provided the codes to ask him directly, then i saw the a red button "ask a question". So i was expecting that it would be sent directly to him coz ive seen it on his page.
Richard MacCutchan 6-Sep-18 3:49am    
You need to use the forum at the end of the article. However, I do not think the author has been around here for some time.
foxCodex 6-Sep-18 21:40pm    
Yes, i thought so too. Like i said, i checked his profile and hoped for answers anyway. Btw. How can i delete this post?

1 solution

At the bottom of the page for article Embedding a .NET WinForms Application in an Internet Browser Using WPF[^] there is a forum for posting questions and comments to the author of the article.

Posting it here is relying on them just dropping by at the right moment - unlikely.
 
Share this answer
 
Comments
foxCodex 5-Sep-18 20:54pm    
I saw that part and I asked one of them with the same concern as mine but still no response. So I tried to ask the one who posted the codes but as you can see, I've done it wrong.
CHill60 6-Sep-18 3:42am    
There are no comments from you on that forum which might explain why there is no answer - unless you are Louis and have two accounts here?
foxCodex 6-Sep-18 21:36pm    
Yeah.. because i only sent an email not a comment

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