Copying table contents from a webpage into .txt file with C#.Net


hi everybody

i want copy table contents webpage .txt file c#.net.

how can windowsformapplication in visual c#.net?

thank you

 


new ideas, superior solutions www.salamgroup.net

hi,

you can use webbrowser control this.

you have to go through each  tr , td find exact value.  example.

  htmldocument document = webbrowser.document;   if (document != null && outerhtml !=null)                  {                                          htmlelementcollection tablecollection = document.getelementsbytagname("table");                      foreach (htmlelement table in tablecollection)                      {  							htmlelementcollection trcoll = table.getelementsbytagname("tr");  							 foreach (htmlelement row in trcoll)                               {  								htmlelementcollection tds = row.getelementsbytagname("td");  								 if (tds != null && tds.count > 1)                                      {  									string texttoextract = tds[0].innertext;                                          if ((texttoextract.indexof("hellothisisanil", stringcomparison.invariantcultureignorecase) == -1)  										{  											//store extracted  value variable ,   write text file streamwriter.  										}  									}  						     }  					}  				}  

i think it  helpful you.


software developer


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'