IP2Currency: Microsoft ASP.Net - VB.Net Sample Code

The sample code below provide you an example on how to obtain the latest currency exchange rate and the homeland currency by visitor's IP address.

'//  This source code is only licensed to our premium subscribers. It is provided "as is" and without warranties.
'//  http://www.fraudlabs.com © All Rights Reserved 2012
Public Class IP2CurrencyWebServiceSoapClient
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents txtVisitorIP As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtFromCurrencyCode As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtToCurrencyCode As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtFromAmount As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtLicense As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtResult As System.Web.UI.WebControls.TextBox
    Protected WithEvents btnClear As System.Web.UI.WebControls.Button
    Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

    Private Sub IP2CurrencyWebService()
        Dim x_IP2Currency As New IP2CurrencyWebService.IP2CurrencyWebService
        Dim oIP2Currency As New IP2CurrencyWebService.IP2CurrencyOutput
        Dim iIP2Currency As New IP2CurrencyWebService.IP2CurrencyInput

            iIP2Currency.VISITORIP = Me.txtVisitorIP.Text
            iIP2Currency.FROMCURRENCYCODE = Me.txtFromCurrencyCode.Text
            iIP2Currency.TOCURRENCYCODE = Me.txtToCurrencyCode.Text
            iIP2Currency.FROMAMOUNT = Me.txtFromAmount.Text
            iIP2Currency.VISITORIP = Me.txtVisitorIP.Text
            iIP2Currency.LICENSE = Me.txtLicense.Text

            oIP2Currency = x_IP2Currency.IP2Currency(iIP2Currency)

			txtResult.Text = "FROMCURRENCYCODE:" & oIP2Currency.FROMCURRENCYCODE & vbNewLine
			txtResult.Text += "TOCURRENCYCODE:" & oIP2Currency.TOCURRENCYCODE & vbNewLine
			txtResult.Text += "TOCURRENCYSYMBOL:" & oIP2Currency.TOCURRENCYSYMBOL & vbNewLine
			txtResult.Text += "FROMAMOUNT:" & oIP2Currency.FROMAMOUNT & vbNewLine
			txtResult.Text += "TOAMOUNT:" & oIP2Currency.TOAMOUNT & vbNewLine
			txtResult.Text += "CONVERSIONRATE:" & oIP2Currency.CONVERSIONRATE & vbNewLine
			txtResult.Text += "TOCOUNTRYNAME:" & oIP2Currency.TOCOUNTRYNAME & vbNewLine
			txtResult.Text += "TOCOUNTRYCODE:" & oIP2Currency.TOCOUNTRYCODE & vbNewLine
			txtResult.Text += "CREDITSAVAILABLE:" & oIP2Currency.CREDITSAVAILABLE & vbNewLine
			txtResult.Text += "MESSAGE:" & oIP2Currency.MESSAGE & vbNewLine
        Catch ex As Exception
        End Try
    End Sub

    Private Sub ClearScreen()
        Me.txtVisitorIP.Text = ""
        Me.txtFromCurrencyCode.Text = ""
        Me.txtToCurrencyCode.Text = ""
        Me.txtFromAmount.Text = ""
        Me.txtVisitorIP.Text = ""
        Me.txtLicense.Text = ""
        Me.txtResult.Text = ""
    End Sub

    Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    End Sub
End Class

Download the source code
You need a license key for the solution. And, it is free and available at IP2Currency Free License