IP2Currency: Microsoft ASP.Net 2.0 - 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.


Partial Class IP2CurrencyWebServiceSoapClient
    Inherits System.Web.UI.Page

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

    Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClear.Click
        Me.ClearScreen()
    End Sub

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

        Try
            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
            Response.Write(ex.Message)
        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
End Class

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