The reason you've got items "one-under-another" instead of "side-by-side" is that that you've created 2 separated loops:
For Each Products As HtmlNode In div.SelectNodes("//div[@class='marketplace-collectible-list']//a[@class = 'catalog-item-name']")
DataGridView1.Rows.Add(Products.InnerText.Trim())
Next
For Each Links As HtmlNode In div.SelectNodes("//div[@class='marketplace-collectible-list']//div[@class = 'image-container']//img//@src")
DataGridView1.Rows.Add(Links.Attributes("src").Value)
Next
You have to add a set of product-link at once.
As far as i see, the common part of set of product-link is:
<div class="row catalog-item-info">...</div>
So, you have to loop through the collection of that
div
s and select single node for product, then for link.
Dim dt As DataTable = New DataTable()
dt.Columns.Add(New DataColumn("Product"))
dt.Columns.Add(New DataColumn("Link"))
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim siteaddress As String = "https://www.hobbydb.com/marketplaces/hobbydb/catalog_items?utf8=%E2%9C%93&q=thanos+sideshow&commit=Go"
Dim doc As HtmlDocument = New HtmlWeb().Load(siteaddress)
Dim div As HtmlNode = doc.DocumentNode.SelectSingleNode("//div[@class='marketplace-collectible-list']")
For Each item As HtmlNode In div.SelectNodes("*//div[@class = 'row catalog-item-info']")
Dim product As HtmlNode = item.SelectSingleNode("*//a[@class = 'catalog-item-name']")
Dim link As HtmlNode = item.SelectSingleNode("*//div[@class = 'image-container']//img//@src")
dt.Rows.Add(New Object(){product.InnerText.Trim(), link.Attributes("src").Value})
Next
DataGridView1.DataSource = dt
Note: Not tested! But it should works fine.
[EDIT]
To get sub-div in context of specific HtmlNode, there's a need to use "
*
". For further details, please see:
XPath Examples | Microsoft Docs[
^]
Check out updated code.
Good luck!