views:

383

answers:

0

I have a NET Compact Framework 3.5 application, which is a form containing a web browser control. The code behind is like this:

    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        webBrowser1.DocumentText =
            "<html><body>Please enter your name:<br/>" +
            "<input type='text' name='userName'/><br/>" +
            "<a href='http://www.microsoft.com'&gt;continue&lt;/a&gt;" +
            "</body></html>";
        webBrowser1.Navigating +=
            new WebBrowserNavigatingEventHandler(webBrowser1_Navigating);
    }

    private void webBrowser1_Navigating(object sender,
        WebBrowserNavigatingEventArgs e)
    {
        System.Windows.Forms.MessageBox.Show(e.Url.ToString());
    }

Basically, set up a simple document, and add an event handler for Navigating. When the event handler is called by clicking the link in the page, display a message box.

This code works fine with the regular .NET framework, but in the CF version (on Windows CE emulator) the Url in the event handler is null.

I presume this is a difference between the two, but it seems pretty fundamental. Anyone know if I am doing something dumb, or if there is a work around.

related questions