Hello everyone, please tell me how can I list the links on the web page in the listBox? I use the webBrowser1 element. I tried this:


However, only a (Collection) was added to the listBox and that’s it, but the links themselves were not.

    1 answer 1

    It is necessary to sort through the Links collection, for example, using foreach:

     foreach (HtmlElement e in web.Document.Links) { list.Items.Add(e.НужноеПолеКласса); } 

    Alternatively, use data binding:

     list.DataSource = web.Document.Links; list.DisplayMember = "ПолеКотороеБудетОтображаться"; list.ValueMember = "ЗначениеПрячещеесяЗаОтображающимсяПолем";