Hello I need help getting this to display the 3 outputs (Euro, Franc, Rand) with 2 decimal places (1.00)
I have all the calculations done so this is what I have as my code:

Public Class frmConvert

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

    End Sub


    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click

        Me.Close()

    End Sub

    Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click

        txtEur.Text = txtDollar.Text * 0.89
        txtFranc.Text = txtDollar.Text * 0.95
        txtRand.Text = txtDollar.Text * 11.54


    End Sub
End Class

Recommended Answers

All 3 Replies

Hi, Cameron 2, welcome. :)
Use Format:
' Returns "5,459.40".
TestStr = Format(5459.4, "##,##0.00")
Taken from the example at the end of this webpage

commented: Useful Resource +5

You are aware that you let the compiler do your conversions from text to decimal. Put option strict on and you will get some errors.Why? because you are multiplying text as in:

 txtEur.Text = txtDollar.Text * 0.89

It is much better to declare variables correctly like:
Dim DecDollar as Decimal =0 etc.

commented: So true! +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.