5 Minute Developer: How to Build a Real-Time Precious Metal Quote Application in 5 Minutes
First Published Tuesday, 9th March 2010 03:06 pm from Xand : ChasCooper
The opinions expressed by this blogger and those providing comments are theirs alone, this does not reflect the opinion of Automated Trader or any employee thereof. Automated Trader is not responsible for the accuracy of any of the information supplied by this article.
/>
src="http://api.tweetmeme.com/imagebutton.gif?url=?url=http%3A%2F%2Fxignite.web-services-blog.com%2F2010%2F03%2F5-minute-developer-how-to-build-a-real-time-precious-metal-quote-application-in-5-minutes%2F&source=xignite&style=normal"
height="61" width="51" />
href="http://www.overthehillandonaroll.com/2009/06/how-to-make-butter-in-under-5-minutes.html"
target="_blank">beat cream into butter, rel="nofollow"
href="http://www.starchamber.com/paracelsus/elvish/elvish-in-ten-minutes.html"
target="_blank">write half of your name in Elvish,
href="http://www.metacafe.com/watch/372595/tattoo_gun_homemade_in_5_minutes/"
target="_blank">create a homemade tattoo gun. Or if
you want to get really wild, you could spend your next 5 minutes
creating a Windows application to get real-time precious metal
quotes. If that's a little too wild for you, you could also live
vicariously through us by href="http://www.xignite.com/gold-metal/web-service/2000206.html">watching
a video of us doing it. But if you're ready to throw
caution to the wind and give it a try for yourself, here's
how:
Step 1: Start a new Windows
application project in Visual Studio using VB.NET as the
language. (You can use any language, but this example just
happens to use VB.NET.)
Step
2: Create a web reference to
http://www.xignite.com/xMetals.asmx?WSDL and call it
XigniteMetals.
Step
3: On the Form1 design, drag and drop 2 text
boxes, 3 labels, and a button, arranging them as shown in the
picture. Give the left-most text box a name of tbMetal and
default text of XAU. Give the right-most text box a name of
tbCurrency and a default text of USD. From left to right, the
labels should be given the following names and default text
values: lIntro defaults to "Right now ", lCosts defaults to "
costs ", PriceLabel defaults to "0.00." The button should have a
default text value of "Get Quote."
class="aligncenter"
src="http://cdn.xignite.com/blog/03_09_10/5MinuteMetalsSpotPriceApp.png"
alt="" />
Step
4: Double-click the button to create its click
event handler. Then add the following lines of code inside the
event handler:
Dim
xHeader As New
XigniteMetals.Header()
xHeader.Username =
"MYAUTHENTICATIONKEY"
Dim XigniteMetalsWebService
As New
XigniteMetals.XigniteMetals()
XigniteMetalsWebService.HeaderValue = xHeader
Dim
Quote
As XigniteMetals.MetalQuote =
_
XigniteMetalsWebService.GetRealTimeMetalQuote(_
DirectCast([Enum].Parse(GetType(XigniteMetals.MetalTypes),
tbMetal.Text), XigniteMetals.MetalTypes), _
DirectCast([Enum].Parse(GetType(XigniteMetals.MetalCurrencyTypes),
tbCurrency.Text), XigniteMetals.MetalCurrencyTypes))
PriceLabel.Text =
Quote.Rate.ToString("#,###.00″)
Step 5: Replace
"MYAUTHENTICATIONKEY"
in the second line of code with your Xignite authentication key.
Don't have one? Just href="https://www.xignite.com/MyAccount/Register.aspx">sign up
for a free trial and use your e-mail address as your
initial authentication key.
Step
6: Compile and run.
Congratulations! You might
make a lousy tattooed elf chef, but you'll be the life of the
party with precious metal traders.
Share and Enjoy:
title="email" alt="email" class="sociable-hovers" />
title="Twitter" alt="Twitter" class="sociable-hovers"
title="Facebook" alt="Facebook" class="sociable-hovers"
title="LinkedIn" alt="LinkedIn" class="sociable-hovers"
title="Digg">
src="http://xignite.web-services-blog.com/wp-content/plugins/sociable/images/digg.png"
title="Digg" alt="Digg" class="sociable-hovers" />
title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers"
title="Technorati" alt="Technorati" class="sociable-hovers"
title="Suggest to Techmeme via Twitter" alt="Suggest to Techmeme
via Twitter" class="sociable-hovers" /> rel="nofollow" target="_blank"
href="http://delicious.com/post?url=http%3A%2F%2Fxignite.web-services-blog.com%2F2010%2F03%2F5-minute-developer-how-to-build-a-real-time-precious-metal-quote-application-in-5-minutes%2F&title=5%20Minute%20Developer%3A%20%20How%20to%20Build%20a%20Real-Time%20Precious%20Metal%20Quote%20Application%20in%205%20Minutes¬es=In%205%20minutes%2C%20create%20a%20simple%20Windows%20application%20that%20gets%20real-time%20precious%20metal%20prices%20over%20the%20Internet%2C%20including%20gold%2C%20silver%2C%20platinum%20and%20palladium."
title="del.icio.us">
src="http://xignite.web-services-blog.com/wp-content/plugins/sociable/images/delicious.png"
title="del.icio.us" alt="del.icio.us" class="sociable-hovers"
title="Google Bookmarks" alt="Google Bookmarks"
title="Live">
src="http://xignite.web-services-blog.com/wp-content/plugins/sociable/images/live.png"
title="Live" alt="Live" class="sociable-hovers" />



