Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi;
what click in link webbrowser c#???

CSS
<a href="/wiki/Special:Random" title="Load a random article [alt-shift-x]" accesskey="x">Random article</a>
Posted

C#
foreach (System.Windows.Forms.HtmlElement html in webBrowser1.Document.GetElementsByTagName("a"))
{
    if (html.InnerText == "Random article")
    {
        html.InvokeMember("click");
    }
}
 
Share this answer
 
To handle a link click in a WebBrowser control, override the control's Navigating event, e.g.:
private void webBrowser_Navigating
  (object sender,
   WebBrowserNavigatingEventArgs e)
{
  e.Cancel = true;  // to prevent browser control from going to link
  MessageBox.Show ("Hello");
}
/ravi
 
Share this answer
 
Comments
Samad blaj 27-Nov-14 4:22am    
noooo; click link in web browser c#.
help me?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900