-3

Please check below some a tag link in there I want to receive bosWDC5M1C8oeVu, DaleyBlind_fan, jkjinc1 like this 3word with show this in my listbox or textbox.


          @bosWDC5M1C8oeVu
        

          @DaleyBlind_fan
        

          @jkjinc1
        

         www.stackoverflow.com
        

In my textbox or listbox show line process.

bosWDC5M1C8oeVu

DaleyBlind_fan

jkjinc1

see this code not received data in my listbox what I am want.

 HtmlElementCollection bColl = webBrowser1.Document.GetElementsByTagName("a");
        foreach (HtmlElement bEl in bColl)
        {
            if (bEl.GetAttribute("data-aria-label-part") != null)
            listBox1.Items.Add(bEl.GetAttribute("href"));
        }

this code I am getting all href link but I need only my detection line what I am want.

  • Can you please rephrase the question and the question title? This is very unclear. Please also paste any code you have so we can try and get an understanding of what you're trying to do. Thanks. – Matt Kelly Aug 21 '15 at 04:44
  • I am added my code actually I am just want show in my list box bosWDC5M1C8oeVu DaleyBlind_fan jkjinc1 – bobette hardnett Aug 21 '15 at 04:48

1 Answers1

0

You are not formatting your if statement correctly (you forgot the curly brackets). Try this code:

HtmlElementCollection bColl = webBrowser1.Document.GetElementsByTagName("a");
    foreach (HtmlElement bEl in bColl)
    {
        if (bEl.GetAttribute("data-aria-label-part") != null) {
            listBox1.Items.Add(bEl.GetAttribute("href"));
        }
    }

Note the { after != null) and the } after ("href"));.

I hope this helps.

Matt Kelly
  • 1,451
  • 2
  • 13
  • 30
  • This code & my code working same process but I am getting all link like in the website available some different link where not show like this code. – bobette hardnett Aug 21 '15 at 05:09
  • Please check 4tag a tag area that's I am don't need but this also show in my list box area so I am getting issue otherwise my – bobette hardnett Aug 21 '15 at 05:12
  • Ok I'm sorry I can't help you without you clearing this question up. Please list a few more details like what language you are writing this in, and include in the question. It appears English isn't your first language but its made it a bit difficult to understand what you are trying to achieve. Hopefully I can help you further. – Matt Kelly Aug 21 '15 at 06:10