mahdi0000
mahdi0000

Reputation: 7

Reuse of null class

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?

Upvotes: -2

Views: 47

Answers (1)

Klaus Gütter
Klaus Gütter

Reputation: 11977

Add wb1 = new WebKitBrowser(); to timer1_Tick

Upvotes: 0

Related Questions