Visual Basic 2005 programming question

Zap Brannigan

Golden Member
Oct 14, 2004
1,887
0
0
I'm having trouble converting some currencies in this program I made.

Anyone know what I need ot get this working properly? So far here is what I have,




Option Explicit On
Option Strict Off



Public Class Form1

Private Sub xClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xClear.Click

Me.xDollarsTextBox.Text = String.Empty
Me.xPoundsTextBox.Text = String.Empty
Me.xPesosTextBox.Text = String.Empty

End Sub

Private Sub xExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExit.Click
Me.Close()

End Sub

Private Sub xCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xCalc.Click

Dim Dollars As Integer
Dim Pounds As Integer
Dim Pesos As Integer

Pounds = Dollars * 0.571505
Pesos = Dollars * 10.7956




Me.xPoundsTextBox.Text = Pounds.ToString

Me.xPesosTextBox.Text = Pesos.ToString
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Can you tell us what errors you are getting and/or what doesn't work? Just posting code and asking people to fix it won't get you anywhere. Sure, you might get working code but you won't learn anything in the process.

From what I can tell your code is incomplete, as in you haven't finished writing everything for the program to even attempt to work.
 

joutlaw

Golden Member
Feb 18, 2008
1,108
2
81
Where are your inputs.

You probably need to have

Dim Dollars as Integer = CInt(xDollarsTextBox.Text)
etc...
 

joutlaw

Golden Member
Feb 18, 2008
1,108
2
81
Also after I looked at it... I dont think you need to be using integer as the type. I would use Double. Integers are whole numbers I believe.


convert you textbox inputs as so:
CDbl(textbox.text)
 

joutlaw

Golden Member
Feb 18, 2008
1,108
2
81
I don't know if this is for a class or a program you would like to use in the future... but I'd put the exchange rate in a app.config file so you won't have re-compile when the exchange rate changes.
 

KLin

Lifer
Feb 29, 2000
30,206
558
126
Originally posted by: joutlaw
I don't know if this is for a class or a program you would like to use in the future... but I'd put the exchange rate in a app.config file so you won't have re-compile when the exchange rate changes.

Definitely homework question.
 

Zap Brannigan

Golden Member
Oct 14, 2004
1,887
0
0
When I try to add ,

Const poundsrate As Decimal = 0.571505 it underlines pounds rate in green and says unused local variable

I made 3 text boxes on the form, xDollarsTextBox, etc....
 

Zap Brannigan

Golden Member
Oct 14, 2004
1,887
0
0
Originally posted by: KLin
Originally posted by: joutlaw
I don't know if this is for a class or a program you would like to use in the future... but I'd put the exchange rate in a app.config file so you won't have re-compile when the exchange rate changes.

Definitely homework question.

Oh you're a big help. lol
 

brandonbull

Diamond Member
May 3, 2005
6,362
1,219
126
I also think it's not a good practice to mix integer and decimal data types. Integers like to to get of decimals.

I'd also have some input validation for your text boxes. If you input alphas, makes it hard to multiple.
 

Zap Brannigan

Golden Member
Oct 14, 2004
1,887
0
0
Originally posted by: brandonbull
I also think it's not a good practice to mix integer and decimal data types. Integers like to to get of decimals.

I'd also have some input validation for your text boxes. If you input alphas, makes it hard to multiple.

Thanks! Yeah the decimals and integers were clashing. What can I say, I'm learning as I go. lol
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |