Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

BC30203: Identifier expected in a n if statement

Posted on 2014-01-31
6
Medium Priority
?
318 Views
Last Modified: 2014-01-31
I am getting the error "BC30203: Identifier expected." on this line if Div.selectSingleNode("./td[@class='score']").InnerText != 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

Open in new window

0
Comment
Question by:runnerjp2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39823617
Hi,

Use the following instead:

if Div.selectSingleNode("./td[@class='score']").InnerText <> nothing then

Open in new window


Giannis
0
 

Author Comment

by:runnerjp2005
ID: 39823625
Hi Giannis,


I now get the error

System.NullReferenceException: Object variable or With block variable not set.
0
 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39823628
Hmmm... Try the following:

if not Div.selectSingleNode("./td[@class='score']") is nothing then

Open in new window


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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 23

Expert Comment

by:Ioannis Paraskevopoulos
ID: 39823632
I have updated my previous post.
0
 

Author Comment

by:runnerjp2005
ID: 39823635
Operator '<>' is not defined for type 'HtmlNode' and 'Nothing'. is the error i get now....

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

Open in new window


its different from other question as im looking to deal with null values
0
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 2000 total points
ID: 39823639
Check my updated post:

If Not Div.selectSingleNode(".//td[@class='score']") Is Nothing Then

Open in new window


Giannis
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question