In this Quick Start Guide, you will learn how to download the DotNetBrowser library, get an evaluation licence, and create, configure and run your first .NET WinForms Application which loads and displays the www.google.com web page.


Environment:

Windows 7, Microsoft Visual Studio 2013, .NET Framework 4.5.


The sample solution that demonstrates how to embed lightweight or heavyweight controls into WinForms applications can be downloaded here. The projects in this solution have NuGet dependencies, which will be resolved automatically during build. 


1. Download the Library


To download the DotNetBrowser library go to http://www.teamdev.com/dotnetbrowser and click the Download button. Extract the downloaded dotnetbrowser.zip archive into the D:\Projects\DotNetBrowser\ directory.


2. Download the Licence


To get a free 30-day evaluation licence please fill the web form and click Get Evaluation. You will receive an email with a link. Use this link to download your evaluation licence (teamdev.licenses). Save the licence file to the D:\Projects\DotNetBrowser\Library\ directory.


3. Create a Windows Forms Application


Create a new WinForms.DotNetBrowser Windows Forms Application C# Project or Windows Forms Application Visual Basic Project in the D:\Projects\DotNetBrowser directory:




4. Add DotNetBrowser.dll


In Solution Explorer right-click References and select Add Reference... menu item:




In the opened Reference Manager dialog click the Browse... button:




Select the D:\Projects\DotNetBrowser\Library\DotNetBrowser.dll file and click Add:




Click OK:



DotNetBrowser.Chromium.dll is found automatically if it is located in the same folder, nearDotNetBrowser.dll. But you may add it to your references too, especially if the project deployment is done using Visual Studio. Both of these assemblies are required to be present.


5. Add your Licence


In Solution Explorer right-click WPF.DotNetBrowser and select the Add — Existing Item... menu item:




In the File Open dialog select D:\Projects\DotNetBrowser\Library\teamdev.licenses  and click Add :




In Solution Explorer right-click teamdev.licenses and select Properties:




In the Properties panel change Build Action to Embedded Resource:




6. Change the Source Code


Insert the following code into the Form1 file:


7.a C#


Form1.cs

using System.Windows.Forms;
using DotNetBrowser;
using DotNetBrowser.WinForms;

namespace WinForms.DotNetBrowser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            BrowserView browserView = new WinFormsBrowserView();
            Controls.Add((Control) browserView);
            browserView.Browser.LoadURL("http://www.google.com");
        }
    }
}

 

7.b Visual Basic .NET


Form1.vb

Imports DotNetBrowser
Imports DotNetBrowser.WinForms

Public Class Form1
    Public Sub New()
        InitializeComponent()

        Dim browserView = New WinFormsBrowserView()
        Controls.Add(browserView)
        browserView.Browser.LoadURL("http://www.google.com")
    End Sub
End Class

 


8. Run your Application


To run your application press F5 or click the Start button in the toolbar. If you have done everything correctly then you will see the following output: