G
Guest
I'm learning Visual Basic using the .Net Framework 2.0. I have been playing
with consuming web services in applications.
I am using a free web service that gives me information for currency
conversion. The web service I am using is:
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
It's got pretty much everything I need, but I'm running into trouble.
I want 2 comboboxes in the application. Both of them need to contain the
names of the currencies that provide conversion factors. The names of the
currencies are 3 letter names that are names of are ENUM constants.
The function that provides the copnversion factor takes 2 arguments -- The
currency we're converting FROM, and the currency we're converting TO.
I'm trying to get the constant names in the dropdowns.
Here's the code so far:
Imports CurrencyConversion.wsCurrency.CurrencyConvertor
Imports CurrencyConversion.wsCurrency.Currency
Imports System.Windows.Forms
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim wsCurrencyNames As CurrencyConversion.wsCurrency.Currency
Dim arrayCurrencyName As New ArrayList()
'For Each wsCurrencyNames In
CurrencyConversion.wsCurrency.Currency.GetNames(GetType(wsCurrency.Currency))
'cbxFromCurrency.Items.Add(wsCurrencyNames.ToString())
'cbxToCurrency.Items.Add(wsCurrencyNames.ToString())
'Next
'cbxFromCurrency.DataSource =
System.Enum.GetNames(typeof(CurrencyConversion.wsCurrency.Currency))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dblRate As Double
Dim wsConvert As New wsCurrency.CurrencyConvertor
dblRate = wsConvert.ConversionRate(GBP, USD)
rtbResults.Text = CStr(dblRate)
End Sub
End Class
This line:
dblRate = wsConvert.ConversionRate(GBP, USD)
is the function that does work when values are entered directly. But I want
the user to choose from the list. Any ideas?
with consuming web services in applications.
I am using a free web service that gives me information for currency
conversion. The web service I am using is:
http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
It's got pretty much everything I need, but I'm running into trouble.
I want 2 comboboxes in the application. Both of them need to contain the
names of the currencies that provide conversion factors. The names of the
currencies are 3 letter names that are names of are ENUM constants.
The function that provides the copnversion factor takes 2 arguments -- The
currency we're converting FROM, and the currency we're converting TO.
I'm trying to get the constant names in the dropdowns.
Here's the code so far:
Imports CurrencyConversion.wsCurrency.CurrencyConvertor
Imports CurrencyConversion.wsCurrency.Currency
Imports System.Windows.Forms
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim wsCurrencyNames As CurrencyConversion.wsCurrency.Currency
Dim arrayCurrencyName As New ArrayList()
'For Each wsCurrencyNames In
CurrencyConversion.wsCurrency.Currency.GetNames(GetType(wsCurrency.Currency))
'cbxFromCurrency.Items.Add(wsCurrencyNames.ToString())
'cbxToCurrency.Items.Add(wsCurrencyNames.ToString())
'Next
'cbxFromCurrency.DataSource =
System.Enum.GetNames(typeof(CurrencyConversion.wsCurrency.Currency))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dblRate As Double
Dim wsConvert As New wsCurrency.CurrencyConvertor
dblRate = wsConvert.ConversionRate(GBP, USD)
rtbResults.Text = CStr(dblRate)
End Sub
End Class
This line:
dblRate = wsConvert.ConversionRate(GBP, USD)
is the function that does work when values are entered directly. But I want
the user to choose from the list. Any ideas?