Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Xml
- Public Class Form1
- Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
- Dim symlist = "aapl,goog,aeo,gs,anr"
- Dim symarr() = symlist.Split(",")
- getQuotes(symarr)
- For Each row As DataGridViewRow In DataGridView1.Rows
- If CDbl(row.Cells(3).Value.ToString) < 0 Then
- row.Cells(3).Style.BackColor = Color.Red
- Else
- row.Cells(3).Style.BackColor = Color.Green
- End If
- If CDbl(row.Cells(4).Value.ToString) < 0 Then
- row.Cells(4).Style.BackColor = Color.Red
- Else
- row.Cells(4).Style.BackColor = Color.Green
- End If
- Next
- End Sub
- Public Sub getQuotes(ByVal arr() As String)
- For Each n As String In arr
- Dim doc As XmlDocument
- ' Create a new XmlDocument
- doc = New XmlDocument()
- ' Load data
- Dim XMLString As String = "http://dev.markitondemand.com/Api/Quote?symbol=THESYMBOL"
- XMLString = XMLString.Replace("THESYMBOL", n)
- doc.Load(XMLString)
- 'Read Data
- Dim xmlreader1 = New XmlNodeReader(doc)
- Dim data1 As String = ""
- While xmlreader1.Read()
- Select Case xmlreader1.NodeType
- Case XmlNodeType.Text
- If Not xmlreader1.Value = "SUCCESS" Then
- data1 = data1 & xmlreader1.Value & ","
- End If
- End Select
- End While
- Dim data1array = data1.Split(",")
- DataGridView1.Rows.Add(data1array)
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment