[AccessD] Exchange Rate - Currency Converter thingy

Salakhetdinov Shamil mcp2004 at mail.ru
Sat Jun 30 13:08:28 CDT 2012


Hi Mark --

I have rechecked LINQPad - it has "Additional Namespace Imports" feature (F4).
Using that feature I have added two namespaces linked to the code snippet:

Microsoft.VisualBasic.Strings
Microsoft.VisualBasic.Interaction

And VB.NET code equivalent looks now exactly as  is in VBA:
Public Sub Main()
Dim uri As String
uri = "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"
Dim xmlDoc As Object 'New MSXML2.DOMDocument30
xmlDoc = CreateObject("MSXML2.DOMDocument.3.0")
xmlDoc.async = False
xmlDoc.Load (uri)
Dim xml As String
xml = xmlDoc.DocumentElement.xml
Dim pos1 As Integer
Dim pos2 As Integer
Dim currencyCode As String
currencyCode = "RUB"
pos1 = InStr(xml, "currency=""" + currencyCode)
pos1 = InStr(pos1, xml, "rate=""")
pos1 = InStr(pos1 + 1, xml, """")
pos2 = InStr(pos1 + 1, xml, """")
Dim currencyRate As String
currencyRate = Mid(xml, pos1 + 1, pos2 - pos1 - 1)
dim output as string
output = "EUR/" + currencyCode + " => " + currencyRate
output.Dump("Test Result")
End Sub

Sorry for any inconvenience with my first "extreme verbosity" VB.NET sample posting.

Thank you.
-- Shamil


Fri, 29 Jun 2012 22:58:40 -0400 от "Mark Simms" <marksimms at verizon.net>:
 
  
  
> Do you see many differences with VBA?

Extreme verbosity....not elegant at all.



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
    


More information about the AccessD mailing list