Hello I hope someone can help me with this problem that I am having I have a class called myBrowser which inherits from the WebBrowser control this control is opened in a STA thread the browser navigates to a given address then fills in the web forms controls but when I try to use InvokeMember("click") nothing happens. I have tryed to use the following code to click the link

C#
        void ClickLink(HtmlElement link)    
        {        
                if (this.InvokeRequired)        
                {            
                        this.BeginInvoke((MethodInvoker)delegate() 
                        {                
                                ClickLink(link);            
                        });        
                }        
                else        
                {            
                        link.InvokeMember("click");        
                }    
        }

When this method is called from the following

C#
    HtmlElementCollection links = this.Document.GetElementsByTagName("a");
    foreach (HtmlElement link in links)    
    {         
        string href = link.GetAttribute("href").ToLower();         
        if (link.InnerText != null)         
        {             
                text = link.InnerText.ToLower();         
        }  
       


        foreach (string fname in address)         
        {              
                if (href.Contains(fname)|| text.Contains(fname))
                {                   
                        ClickLink(link);                   
                        // link.InvokeMember("click");                   
                        Thread.Sleep(5000);                   
                        //   Application.Run();                   
                        while(this.ReadyState!=WebBrowserReadyState.Complete)
                        {                      
                                Application.DoEvents();                   
                        }              
                }        
        }

nothing happens but when I step through the code in the ClickLink method is just passing over the InvokeRequired if statement and going direct to the else statement.

how can I get the InvokeMember to work.