C#

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetBrowser;
using DotNetBrowser.Events;
using System.Threading;

namespace ExecuteJavaScript
{
    class Program
    {
        static void Main(string[] args)
        {
            using (Browser browser = BrowserFactory.Create())
            {
                ManualResetEvent waitEvent = new ManualResetEvent(false);
                browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
                {
                    // Wait until main document of the web page is loaded completely.
                    if (e.IsMainFrame)
                    {
                        // Execute JavaScript code and get return value from JavaScript.

                        JSValue returnValue = e.Browser.ExecuteJavaScriptAndReturnValue("wpfBridge");
                        // Make sure that return value is an object.
                        if (returnValue.IsObject())
                        {
                            String Val="Hello World";
                            returnValue.AsObject().SetProperty("formDataString", Val);
                        }
                        waitEvent.Set();
                    }
                };
                browser.LoadHTML("<html><head><script>var wpfBridge = new Object();</script></head><body></body></html>");
                waitEvent.WaitOne();
            }
        }
    }
}

VB.NET

Imports DotNetBrowser
Imports DotNetBrowser.Events
Imports System.Threading

Module ExecuteJavaScript
    Sub Main(ByVal args As String())
        Using browser As Browser = BrowserFactory.Create()
            Dim waitEvent As ManualResetEvent = New ManualResetEvent(False)
            AddHandler browser.FinishLoadingFrameEvent,
                sub(ByVal sender As Object, ByVal e As FinishLoadingEventArgs)

                    If e.IsMainFrame Then
                        Dim returnValue As JSValue = e.Browser.ExecuteJavaScriptAndReturnValue("wpfBridge")

                        If returnValue.IsObject() Then
                            Dim Val As String = "Hello World"
                            returnValue.AsObject().SetProperty("formDataString", Val)
                        End If

                        waitEvent.Set()
                    End If
                End sub

            browser.LoadHTML("<html><head><script>var wpfBridge = new Object();</script></head><body></body></html>")
            waitEvent.WaitOne()
        End Using
    End Sub
End Module