-
Sep 9th, 2012, 11:15 AM
#1
Thread Starter
Lively Member
Convert Error from VB6
I have converted my old project from VB6 to VB2008 but there is an uggly error that I chould not resolve.
It whould be great if some one can help me . My error shows this line :
Code:
DebugXML.Text = Inet1.OpenURL("http://
it can not accept this argument ?
-
Sep 9th, 2012, 11:44 AM
#2
Re: Convert Error from VB6
Originally Posted by deve
I have converted my old project from VB6 to VB2008 but there is an uggly error that I chould not resolve.
It whould be great if some one can help me . My error shows this line :
Code:
DebugXML.Text = Inet1.OpenURL("http://
it can not accept this argument ?
I don't suppose VB6 would either if that line is complete! Assuming it does end logically and that DebugXML.Text is a textbox(?), what is Inet1 and what are you actually wanting this to do?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 9th, 2012, 12:26 PM
#3
Thread Starter
Lively Member
Re: Convert Error from VB6
this is all of the code :
Code:
DebugXML.Text = Inet1.OpenURL("http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/driver/" & Text2.Text & "/cars")
xml_document.loadXML(DebugXML.Text)
xm1_node = xml_document.getElementsByTagName("worldCar")
xm2_node = xml_document.getElementsByTagName("physicsProfile")
DebugXML.Text = CStr(CDbl(xm1_node(0).Text) + xm2_node(0).Text)
-
Sep 9th, 2012, 02:20 PM
#4
Re: Convert Error from VB6
Well that makes it a bit clearer. No, VB.Net doesn't handle XML files in that way. There are actually a number of different ways to approach XML. The following, which exploits .Net's inbuilt LINQ support, may be instructive. If not, there are many references on the net. Stick to the most recent!
vb.net Code:
Dim doc As XDocument
doc = XDocument.Load("http://dl.dropbox.com/u/8842115/sample.xml")
For Each node In doc.Descendants("first")
DebugXML.AppendText((CType(node.Element("name"), String)) & vbCrLf)
Next
xml Code:
<root>
<first>
<no>10</no>
<name>mr. a</name>
</first>
<first>
<no>20</no>
<name>mr. b</name>
</first>
</root>
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 9th, 2012, 02:29 PM
#5
Thread Starter
Lively Member
Re: Convert Error from VB6
I am not getting it correctly sorry , how whould I go with this xml output if I wont to have the nodes : carID - make - carName - acceleration - handling - rating - topspeed - carclass ?
<worldCar carId="14717367" make="CAR_MANU_MITSUBISHI" carName="CAR_MDL_ECLIPSEGT">
<physicsProfile acceleration="219" handling="300" rating="254" topSpeed="243" carClass="carclass_d"/>
</worldCar>-
P.S I start to use VS 2010
Last edited by deve; Sep 9th, 2012 at 02:56 PM.
-
Sep 9th, 2012, 03:39 PM
#6
Re: Convert Error from VB6
One way ... you can tidy it up once you've seen how it works ...
vb.net Code:
For Each node In doc.Descendants("worldCar")
Dim ss As String() = Split(node.ToString, " ")
For i = 0 To ss.Length - 1
DebugXML.AppendText(i.ToString & " " & ss(i) & vbCrLf)
Next
Next
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Sep 9th, 2012, 03:43 PM
#7
Thread Starter
Lively Member
Re: Convert Error from VB6
ok my result code looks like this :
Code:
Dim doc As XDocument
doc = XDocument.Load("http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/driver/nfswdriver/car")
For Each node In doc.Descendants("worldCar")
Dim ss As String() = Split(node.ToString, " ")
For i = 0 To ss.Length - 1
TextBox2.Text = (i.ToString & " " & ss(i) & vbCrLf)
Next
Next
result that I get is this only :
12 />
</worldCar>
Last edited by deve; Sep 9th, 2012 at 04:02 PM.
-
Sep 9th, 2012, 04:21 PM
#8
Thread Starter
Lively Member
Re: Convert Error from VB6
Final code looks like this :
Code:
Dim doc As XDocument
doc = XDocument.Load("http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/driver/" + TextBox1.Text + "/car")
For Each node In doc.Descendants("worldCar")
Dim ss As String() = Split(node.ToString, "carId")
For i = 0 To ss.Length - 1
TextBox2.Text = " Drivers Name : " + TextBox1.Text + vbCrLf + (i.ToString & " " & ss(i) & vbCrLf)
Next
Next
output looks like this :
PHP Code:
Drivers Name : nfswdev
1 ="13512645" make="CAR_MANU_DODGE" carName="CAR_MDL_CHARGER07BEE">
<physicsProfile acceleration="547" handling="247" rating="406" topSpeed="426" carClass="carclass_c" />
</worldCar>
What is the 1 in the beginning ? and how can I put all the nodes 1 by 1 in line. like
car id : result
acceleration : result
and so on
the real XML output on the webpage is like this :
PHP Code:
<worldCar carId="13512645" make="CAR_MANU_DODGE" carName="CAR_MDL_CHARGER07BEE">
<physicsProfile acceleration="547" handling="247" rating="406" topSpeed="426" carClass="carclass_c"/>
</worldCar>
-
Sep 9th, 2012, 04:26 PM
#9
Re: Convert Error from VB6
Er ... yes ... slight difference between ....
DebugXML.AppendText(i.ToString & " " & ss(i) & vbCrLf)
and
TextBox2.Text = (i.ToString & " " & ss(i) & vbCrLf)
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|