Results 1 to 4 of 4

Thread: [RESOLVED] School Work

  1. #1

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Resolved [RESOLVED] School Work

    I have this exercise to do but im stumped at what else to do next.
    We have to make a simple Currency converter, i get how to change the currency from US dollars to yen,euros, ans pesos but here is the tricky part,
    the user types in the amount of US dollars they want converted but then the user has to type in Yen, Euro, Pasos in a text then when you hit convert i will convert it to what ever the user typed in the Currency text box,
    but i dont no how to make the program read what the user typed in for currency. The teacher wants us to use the If..ElseIf..ElseIf statements and to display the answer in the lbloutput box is sapose to be displayed by using the String.Format method which i get.
    lol here is all i got for the begining

    VB Code:
    1. Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
    2.         Dim dollars As New Double
    3.         Dim amount As New Decimal
    4.  
    5.  
    6.         dollars = Val(txtValue.Text)
    7.         amount = Val(txtCurrency.Text)

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

  2. #2

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Re: School Work

    ok i got an understanding now i for got to add the "" around the word Yen example "Yen", now when i do math part i get a "End of statement Explected"

    here is the code.
    VB Code:
    1. If amount = "Yen" Then
    2.             val(txtvalue.Text) [B]* 120[/B]

    the part in bold is under lined in blue.

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

  3. #3
    Junior Member
    Join Date
    Apr 2006
    Posts
    23

    Re: School Work

    well its underlined like that because your just multiplying the numbers and not telling the computer to do anything with them.


    DAve

  4. #4

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301
    I redid all the code an it works like a charm now here is the code i did.

    VB Code:
    1. Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
    2.  
    3.         If (txtCurrency.Text = "Yen") Then      'If the user types in Yen it will multiply the users value by 120
    4.             lbloutput.Text = _
    5.                 Val(txtValue.Text) * 120
    6.         ElseIf (txtCurrency.Text = "Euros") Then 'If the user types in Euros it will Multiply the users value by 1.02
    7.             lbloutput.Text = _
    8.                 Val(txtValue.Text) * 1.02
    9.         ElseIf (txtCurrency.Text = "Pesos") Then 'If the user types in Pesos it will Multiply the Users Value by 10
    10.             lbloutput.Text = _
    11.                 Val(txtValue.Text) * 10
    12.         End If
    13.  
    14.     End Sub

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width