Make a Currency Converter in Visual Basic 2005
In this tutorial you will learn how to make a simple currency converter. This is a great tutorial if you are just starting out with Visual Basic. If you haven’t already, you need to download Visual Basic 2005 for free and install it.
First of all you need to open Visual Basic 2005. Hit Ctrl+N or File>New Project. Select ‘Windows Application’. You should see a screen that looks something like this.
If the toolbox is not already open hit Ctrl+Alt+X to open it. Put 3 radio buttons, 3 text boxes and 1 button onto the form. To do this you cab double click the items in the toolbox or drag them on. Rearrange them so they look something like this.
Select RadioButton1 and change the following values in the properties window. (Name): RadioUSD, Checked:True, Text:&USD.
The first radio button should now be selected and instead of being called RadioButton1, it should have USD. The U is underlined so the user can just press Alt+U to select it. Do the same for the other two radio buttons, but with the following values.
RadioButton2: (Name): RadioAUD, Text: &AUD
RadioButton3: (Name): RadioGBP, Text: &GBP
Now select the text box opposite the USD radio button. In the properties panel change the name value to ResultUSD. Do the same for the other two text boxes, but instead of calling them ResultUSD call them ResultAUD and ResultGBP, depending on which radio button they are opposite to.
Select the button and change the following values in the properties panel. (Name): Convert, Text: Convert.
Double click on the Convert button. It should bring up a screen with a bit on code on it. This is where you do all the programming. When you use the code I give you put it between the:
Private Sub Convert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Convert.Click
And the
End Class
Here is the code:
If (IsNumeric(ResultUSD.Text) = True) Then
ResultAUD.Text = (Val(ResultUSD.Text) * 1.1875)
ResultGBP.Text = (Val(ResultUSD.Text) * 0.507)
ElseIf (ResultUSD.Text = "") Then
ResultAUD.Text = "Please enter a value"
ResultGBP.Text = "Please enter a value"
Else
ResultAUD.Text = "Numbers only please"
ResultGBP.Text = "Numbers only please"
End If
End If
If (RadioAUD.Checked = True) Then
If (IsNumeric(ResultAUD.Text) = True) Then
ResultUSD.Text = (Val(ResultAUD.Text) * 0.842)
ResultGBP.Text = (Val(ResultAUD.Text) * 0.4269)
ElseIf (ResultAUD.Text = "") Then
ResultGBP.Text = "Please enter a value"
ResultUSD.Text = "Please enter a value"
Else
ResultGBP.Text = "Numbers only please"
ResultUSD.Text = "Numbers only please"
End If
End If
If (RadioGBP.Checked = True) Then
If (IsNumeric(ResultGBP.Text) = True) Then
ResultAUD.Text = (Val(ResultGBP.Text) * 2.342)
ResultUSD.Text = (Val(ResultGBP.Text) * 1.972)
ElseIf (ResultGBP.Text = "") Then
ResultAUD.Text = "Please enter a value"
ResultGBP.Text = "Please enter a value"
Else
ResultAUD.Text = "Numbers only please"
ResultGBP.Text = "Numbers only please"
End If
End If
Now hit the ‘Start debugging’ () button to see your first Visual Basic program come to life.















It would be better if you had VB6.
cool. I wanna learn VB atm so can you do some more (simple) tuts
thanks
Yea, I will try.
I’ll help you out.
[code]Private Sub Command1_Click()
End
End Sub[/code]
This code closes the program.
Not much of a turoial, as it’s mostly . Tut
Not much of a turoial, as it’s mostly copy and paste. Tut
If (RadioUSD.Checked = True) Then
If (IsNumeric(ResultUSD.Text) = True) Then
ResultAUD.Text = (Val(ResultUSD.Text) * 1.1875)
ResultGBP.Text = (Val(ResultUSD.Text) * 0.507)
ElseIf (ResultUSD.Text = “”) Then
ResultAUD.Text = “Please enter a value”
ResultGBP.Text = “Please enter a value”
Else
ResultAUD.Text = “Numbers only please”
ResultGBP.Text = “Numbers only please”
End If
End If
If (RadioAUD.Checked = True) Then
If (IsNumeric(ResultAUD.Text) = True) Then
ResultUSD.Text = (Val(ResultAUD.Text) * 0.842)
ResultGBP.Text = (Val(ResultAUD.Text) * 0.4269)
ElseIf (ResultAUD.Text = “”) Then
ResultGBP.Text = “Please enter a value”
ResultUSD.Text = “Please enter a value”
Else
ResultGBP.Text = “Numbers only please”
ResultUSD.Text = “Numbers only please”
End If
End If
If (RadioGBP.Checked = True) Then
If (IsNumeric(ResultGBP.Text) = True) Then
ResultAUD.Text = (Val(ResultGBP.Text) * 2.342)
ResultUSD.Text = (Val(ResultGBP.Text) * 1.972)
ElseIf (ResultGBP.Text = “”) Then
ResultAUD.Text = “Please enter a value”
ResultGBP.Text = “Please enter a value”
Else
ResultAUD.Text = “Numbers only please”
ResultGBP.Text = “Numbers only please”
End If
End If
hey everyone…..
i want 2 make a project for my assignment……..n m making on atm(automated teller machine)
i had successfully designed d forms but m damm confused for its coding……….i jst want sum code 2 update d account bal if i withdraw or debit d amount of account bal……plzz help me out
waiting 4 d needful help
regards
is there no one 2 help me out……………………