Reuse of null class

50 views Asked by At

Look at the following codes

namespace WindowsFormsApplication1
{
public partial class myprogram : Form
{
    public myprogram()
    {            
        InitializeComponent();
    }

    WebKitBrowser wb1 = new WebKitBrowser();



     private void timer1_Tick(object sender, EventArgs e)
    {
        timer1.Enabled = false;
        wb1.Navigate("site.com");
        timer2.Enabled = true;
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
        timer2.Enabled = false;
        wb1=null;    
        timer1.Enabled = true;
    }      
}
}

To empty RAM every time, wb1 must be null. But then it gets null and no longer hits and says it has already been null. So how can I get null in timer2 and then Navigate in timer1?

1

There are 1 answers

0
Klaus Gütter On

Add wb1 = new WebKitBrowser(); to timer1_Tick