Hi i'm having a trouble with this i got 3 textbox and i format it to

Textbox1.Text = Format(Textbox1.Text, "Standard")
Textbox2.Text = Format(Textbox2.Text, "Standard")
Textbox3.Text = Format(Textbox3.Text, "Standard")

which give something like this
1,230.00
2,500.00
1,245.00

and when i add it
Textbox4.text = Val(Textbox1.Text) + Val(Textbox2.Text) + Val(Textbox3.Text)
the result is this
4.00

how can i sum it when the format is in "standard" or "percent"?

Val doesn't recognize a ',' as part of a number and stops converting the string there. Thus you end up with 1+2+1 = 4. Try this instead:
TextBox4.Text = Format((Double.Parse(Textbox1.Text) + Double.Parse(Textbox2.Text) + Double.Parse(Textbox3.Text)), "Standard")

Edited 3 Years Ago by tinstaafl

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim t1 As TextBox = New TextBox
        Dim t2 As TextBox = New TextBox
        Dim t3 As TextBox = New TextBox
        Dim t4 As TextBox = New TextBox
        t1.Text = "1,230.00"
        t2.Text = "2,500.00"
        t3.Text = "1,245.00"
        Dim sum As Decimal = isConvert(t1.Text) + _
                             isConvert(t2.Text) + _
                             isConvert(t3.Text)

        t4.Text = String.Format("{0:N2}", sum)
    End Sub
    Protected Function isConvert(ByVal str As String) As Decimal
        Return Decimal.Parse(str)
    End Function
This question has already been answered. Start a new discussion instead.