4
How to Use HTML Agility Pack my project in Visual Studio in C#, as I have a table extracted by an object webbrowsers, the more I go splits in it it stands like an array of almost 700 indexes, I would like to find the elements I want more easily,
private void timer_loteca_Tick(object sender, EventArgs e)
{
//loteca
WebBrowser clienteloteca = new WebBrowser();
clienteloteca.Navigate("http://www1.caixa.gov.br/loterias/loterias/loteca/loteca_pesquisa_new.asp");
clienteloteca.Navigated += clienteloteca_Navigated;
timer_federal.Enabled = false;
}
void clienteloteca_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
try
{
var s = (WebBrowser)sender; ;
string acumulou = string.Empty;
var tabela = s.Document.Body.InnerHtml;
string[] lala = tabela.Split('|');
string[] line22 = Regex.Split(lala[3], "<table" );
string line24 = line22[0].Replace("\r\n","");
string[] line23 = Regex.Split(line24, "</TD>");
var megasena = s.Document.Body.InnerText;
string megasena1 = megasena;
string[] lines = megasena1.Split('|');
string[] line20 = Regex.Split(lines[3], "\r\n");
string[] line30 = Regex.Split(lines[4], "\r\n");
string res1 = line20[1].ToString().Substring(0,1);
string res2 = line20[1].ToString().Substring(1);
string res3 = line20[5].ToString().Substring(0, 1);
string res4 = line20[5].ToString().Substring(1);
string res5 = line20[9].ToString().Substring(0, 1);
string res6 = line20[9].ToString().Substring(1);
string res7 = line20[13].ToString().Substring(0, 1);
string res8 = line20[13].ToString().Substring(1);
string res9 = line20[17].ToString().Substring(0, 1);
string res10 = line20[17].ToString().Substring(1);
string res11 = line20[21].ToString().Substring(0, 1);
string res12 = line20[21].ToString().Substring(1);
string res13 = line20[25].ToString().Substring(0, 1);
string res14 = line20[25].ToString().Substring(1);
string res15 = line20[29].ToString().Substring(0, 1);
string res16 = line20[29].ToString().Substring(1);
string res17 = line20[33].ToString().Substring(0, 1);
string res18 = line20[33].ToString().Substring(1);
}
You will have to give more details because your question is very vague.
– Miguel Angelo
Have you already included Htmlagilitypack in the project? What are the elements you want to get? What is the difficulty you are having with the library?
– Miguel Angelo
then I installed the pack, this in the reference of my project everything normal, I read the documentation of it but I did not understand how I can get the values from inside the table in question.
– Kaique Mota
What platform are you developing? You can add some extremely simple example code to illustrate what you want?
– Paulo Morgado
I am developing in c# windows form in visual studio,
– Kaique Mota