简体   繁体   中英

how to use Mozilla ActiveX Control (axMozillaBrowser1) c#/.net

i am trying to reload a web page 3 times using "axMozillaBrowser1(Mozilla ActiveX Control)" but axMozillaBrowser1 control is not loading web page and it's waiting courser is blinking regular but browser control is not loading web page.

Please tell me how to use axMozillaBrowser1 control properly. Thanx in advance.

this is my program code:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        progressBar1.Maximum = 3;
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
        do
        {
            axMozillaBrowser1.Navigate(textBox1.Text);
            while(axMozillaBrowser1.ReadyState != MOZILLACONTROLLib.tagREADYSTATE.READYSTATE_COMPLETE)
            {
                Application.DoEvents();
                if (axMozillaBrowser1.ReadyState == MOZILLACONTROLLib.tagREADYSTATE.READYSTATE_COMPLETE)
                { 
                    progressBar1.Value = progressBar1.Value + 1; 
                }
            }
        }while(progressBar1.Value != 3);
    }
}

Why you want to Navigate 3 times ?

But my suggest is :

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        progressBar1.Maximum = 3;
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
             progressBar1.Value = 0; 
            axMozillaBrowser1.Navigate(textBox1.Text);
    }

    private void webBrowser2_Navigated(object sender, WebBrowserNavigatedEventArgs e)
    {
        if ( progressBar1.Value < 3 )
        {
            axMozillaBrowser1.Navigate(textBox1.Text);
            progressBar1.Value = progressBar1.Value + 1; 
        }

    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM