Member_2_5230414
asked on
BC30203: Identifier expected in a n if statement
I am getting the error "BC30203: Identifier expected." on this line if Div.selectSingleNode("./td [@class='s core']").I nnerText != null then and i can't figure out why...
For Each div As Object In htmlDoc.DocumentNode.SelectNodes("//div[@class='matches']")' select all the divs within the code that contain *
if Div.selectSingleNode("./td[@class='score']").InnerText != null then
lblHTMLOutput.Text += Div.selectSingleNode("./td[@class='score']").InnerText
end if
Next
ASKER
Hi Giannis,
I now get the error
System.NullReferenceExcept ion: Object variable or With block variable not set.
I now get the error
System.NullReferenceExcept
Hmmm... Try the following:
if that doesn't work, plz provide a sample html where you get the error(if it is different than your other question), and possibly provide more of your code.
Giannis
if not Div.selectSingleNode("./td[@class='score']") is nothing then
if that doesn't work, plz provide a sample html where you get the error(if it is different than your other question), and possibly provide more of your code.
Giannis
I have updated my previous post.
ASKER
Operator '<>' is not defined for type 'HtmlNode' and 'Nothing'. is the error i get now....
full code is
its different from other question as im looking to deal with null values
full code is
Imports System.Net
Imports System.IO
Imports HtmlAgilityPack
Partial Class football_home
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim webGet As New HtmlWeb() 'open the system
Dim htmlDoc As HtmlDocument = webGet.Load("http://www.livefutbol24.com/Football/Live")'' get the html from the webpage
For Each div As Object In htmlDoc.DocumentNode.SelectNodes(".//div[@class='matches']")' select all the divs within the code that contain *
if Div.selectSingleNode(".//td[@class='score']") <> nothing then
lblHTMLOutput.Text += Div.selectSingleNode(".//td[@class='score']").InnerText
end if
Next End Sub
End Class
its different from other question as im looking to deal with null values
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use the following instead:
Open in new window
Giannis