Visual Basic Form Currency Converter

  • Thread starter Thread starter Jonathan.12
  • Start date Start date
J

Jonathan.12

Guest
Hello,

I'm programming as a hobby and I'm making a currency converter (Windows Form) at the moment with the following currencies:

- Euro

- US Dollar

- Canadian Dollar

- Swiss Franc

In the windows form a user can click on the currency and a InputBox ask how much the value is 1 US Dollar = (insert Value) in Euro or Canadian Dollar or Swiss Franc. The InputBox is made with several variables, when someone click US Dollar, the string automatically says US Dollar.

I have made the following ListBox:

Private Sub Converting_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Currencylist.Items.Add(EUR)

Currencylist.Items.Add(USD)

Currencylist.Items.Add(CAND)

Currencylist.Items.Add(SWISS)

End Sub

The select case statement:


Select Case Currencylist.SelectedIndex
Case 0, 1, 2, 3
InputCurrency = InputBox("Give the currency 1 USD = & Currencylist.SelectedItem")

Currencyresult.Text = Currencyresult.test & InputCurrency & Currencylist.SelectedItem

End Select
End Sub



For example I say: 1 dollar is 6 Euro, the result of this input has to be copied in the TextBox "Currencyresult" I made. The result have to be in the same order how the Currencylist is build up. Start with EUR and ending with SWISS:

1 USD = 2 EUR

1 USD = 1 USD

1 USD = 1.5 CAND

1 USD = 1.75 SWISS

It won't work. When I start for example with the currency of SWISS, the TextBox will start with:

1 USD = 1.75 SWISS.

What I'm doing wrong?

Thanks in advance.

Jonathan.

Continue reading...
 
Back
Top