[Mono-winforms-list] Problem with using webbrowser

phallos qqqxers at yahoo.co.uk
Sun Nov 9 04:03:14 EST 2008


I want to give more details about my problem with screenshots and code
listings.

I prepared a very simple form in which there is only a buton and webbrowser
control. When the buton is pushed webbrowser control navigates to a test
page.


Program.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace MonoWebBrowserTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Form1.Designer.cs
namespace MonoWebBrowserTest
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// true if managed resources should be disposed; otherwise, false.
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(12, 12);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(129, 36);
            this.button1.TabIndex = 0;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new
System.EventHandler(this.button1_Click);
            // 
            // webBrowser1
            // 
            this.webBrowser1.Location = new System.Drawing.Point(12, 54);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(593, 278);
            this.webBrowser1.TabIndex = 1;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(617, 344);
            this.Controls.Add(this.webBrowser1);
            this.Controls.Add(this.button1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.WebBrowser webBrowser1;
    }
}


Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MonoWebBrowserTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate("file://C:/MonoWebBrowserTest/test.html");
        }
    }
}


I have 2 machines one of which have both .NET and Mono installation(machine
1) and the other has only Mono installation (machine2). 
I compileand run the code on machine1 Mono command line successfully.
http://www.nabble.com/file/p20404507/NETnMono_cmd.jpg 
http://www.nabble.com/file/p20404507/NETnMono.jpg 

On machine2, I can compile the code on mono command line but when I run it
on mono command line, webbrowser control is not seen on my form.
http://www.nabble.com/file/p20404507/onlyMono_cmd.jpg 
http://www.nabble.com/file/p20404507/onlyMono.jpg 

Part of a listing of my Mono installation directory is as below:
C:\Program Files\Mono-2.0.1>dir xul*
09.11.2008  08:15    <DIR>          xulrunner


Part of a listing of bin directory is as below:
C:\Program Files\Mono-2.0.1\bin>dir glue*
22.10.2008  14:39            69.632 gluezilla.dll


-- 
View this message in context: http://www.nabble.com/Problem-with-using-webbrowser-tp20397721p20404507.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.



More information about the Mono-winforms-list mailing list