473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding values to a combobox from a set of ENUM constants from web

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 CurrencyConvers ion.wsCurrency. CurrencyConvert or
Imports CurrencyConvers ion.wsCurrency. Currency
Imports System.Windows. Forms

Public Class frmMain

Private Sub frmMain_Load(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim wsCurrencyNames As CurrencyConvers ion.wsCurrency. Currency

Dim arrayCurrencyNa me As New ArrayList()
'For Each wsCurrencyNames In
CurrencyConvers ion.wsCurrency. Currency.GetNam es(GetType(wsCu rrency.Currency ))
'cbxFromCurrenc y.Items.Add(wsC urrencyNames.To String())
'cbxToCurrency. Items.Add(wsCur rencyNames.ToSt ring())
'Next

'cbxFromCurrenc y.DataSource =
System.Enum.Get Names(typeof(Cu rrencyConversio n.wsCurrency.Cu rrency))
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim dblRate As Double
Dim wsConvert As New wsCurrency.Curr encyConvertor
dblRate = wsConvert.Conve rsionRate(GBP, USD)
rtbResults.Text = CStr(dblRate)
End Sub
End Class
This line:
dblRate = wsConvert.Conve rsionRate(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?
--
Richard Tocci
College Station, TX

Jun 19 '07 #1
2 2116

"Richard Tocci" <richardftoccij r at hotmail dot comwrote in message
news:BE******** *************** ***********@mic rosoft.com...
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 CurrencyConvers ion.wsCurrency. CurrencyConvert or
Imports CurrencyConvers ion.wsCurrency. Currency
Imports System.Windows. Forms

Public Class frmMain

Private Sub frmMain_Load(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim wsCurrencyNames As CurrencyConvers ion.wsCurrency. Currency

Dim arrayCurrencyNa me As New ArrayList()
'For Each wsCurrencyNames In
CurrencyConvers ion.wsCurrency. Currency.GetNam es(GetType(wsCu rrency.Currency ))
'cbxFromCurrenc y.Items.Add(wsC urrencyNames.To String())
'cbxToCurrency. Items.Add(wsCur rencyNames.ToSt ring())
'Next

'cbxFromCurrenc y.DataSource =
System.Enum.Get Names(typeof(Cu rrencyConversio n.wsCurrency.Cu rrency))
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim dblRate As Double
Dim wsConvert As New wsCurrency.Curr encyConvertor
dblRate = wsConvert.Conve rsionRate(GBP, USD)
rtbResults.Text = CStr(dblRate)
End Sub
End Class
This line:
dblRate = wsConvert.Conve rsionRate(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?
I don't know if you need the Spilt String function or not, because it's
unclear as to what you need to do.

http://builder.com.com/5100-6371-6030362.html

Jun 19 '07 #2
Not quite. Upon further research of this web service, it looks like there is
ANOTHER web service that actually provides me the information I need. Why
it's not all part of the SAME web service, I don't know.

I'll post more if I run into trouble.
--
Richard Tocci
College Station, TX
"Mr. Arnold" wrote:
>
"Richard Tocci" <richardftoccij r at hotmail dot comwrote in message
news:BE******** *************** ***********@mic rosoft.com...
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 CurrencyConvers ion.wsCurrency. CurrencyConvert or
Imports CurrencyConvers ion.wsCurrency. Currency
Imports System.Windows. Forms

Public Class frmMain

Private Sub frmMain_Load(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim wsCurrencyNames As CurrencyConvers ion.wsCurrency. Currency

Dim arrayCurrencyNa me As New ArrayList()
'For Each wsCurrencyNames In
CurrencyConvers ion.wsCurrency. Currency.GetNam es(GetType(wsCu rrency.Currency ))
'cbxFromCurrenc y.Items.Add(wsC urrencyNames.To String())
'cbxToCurrency. Items.Add(wsCur rencyNames.ToSt ring())
'Next

'cbxFromCurrenc y.DataSource =
System.Enum.Get Names(typeof(Cu rrencyConversio n.wsCurrency.Cu rrency))
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim dblRate As Double
Dim wsConvert As New wsCurrency.Curr encyConvertor
dblRate = wsConvert.Conve rsionRate(GBP, USD)
rtbResults.Text = CStr(dblRate)
End Sub
End Class
This line:
dblRate = wsConvert.Conve rsionRate(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?

I don't know if you need the Spilt String function or not, because it's
unclear as to what you need to do.

http://builder.com.com/5100-6371-6030362.html

Jun 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2368
by: Nebula | last post by:
Consider enum Side {Back,Front,Top,Bottom}; enum Side a; Now, why is a = 124; legal (well it really is an integer, but still, checking could be performed..) ? Wouldn't enums be more useful if there was a bit more typechecking ?
3
1482
by: Alan | last post by:
Hi, is it possible to create a project that can offer different members of a Public Enum according to a condition ? I mean, Project A has a public enum. Project B & C access A's enum. However B should see some elements of the enum while C should see others... Is this achievable ??
4
1478
by: UJ | last post by:
I know how to define enums, and they work great. But is there any way to define the same time of thing but give them actual values? For instance, I'd like to define something with the idea like this: Public Enum TMCContentStatus as string PrevApproved = "P" ToBeAdded = "A"
47
3347
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols are objects whose representation within the code is more important than their actual value. Two symbols needs only to be
5
7040
by: Matt D | last post by:
I have a bunch of constants used in my web services that the client also needs to have. Is there a way to declare public properties that are part of a class or structure as constants or at least give them a default value through some XML shaping? Thanks.
6
4900
by: cipher | last post by:
I have some constant values in my web service that my client application will require. Having to keep server side and client side definitions insync is tedious. I am trying to do something like this: public __value enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }; However, the resulting wsdl omits the actual flag values: - <s:simpleType name="Colors">
9
53708
by: Fred Zwarts | last post by:
What is the recommended way to loop over all enum values of a certain enum type? Consider the following definition: typdef enum {A=2, B, C=5, D} E; then for (E x = A; x <= D; ++x) { ... }
8
5846
by: Bart Simpson | last post by:
typedef enum { ACCESS_DENIED = 1, ACCESS_READ_ONLY = 2, ACCESS_READ_WRITE = 4 }AccessTypeEnum ; Is this legal? - can I have 'gaps' in the enumeration integer values as above ?
13
18111
by: toton | last post by:
Hi, I have some enum (enumeration ) defined in some namespace, not inside class. How to use the enum constant's in some other namespace without using the whole namespace. To say in little detail, the enum is declared as, namespace test{ enum MyEnum{ VALUE1,VALUE2 };
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.