hello

the problem is about user when click button coin and it will display the decimal number and suppose to be like this : 0.10

also , i have made code about notes amount like RM 1.00 and RM 5.00 .

here it is:

Private itotal As Decimal = "0.00"
    Private Sub btnseringgit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseringgit.Click
        displaytext.Text = itotal
        itotal = itotal + 1
        displaytext.Text = Convert.ToString(itotal)
    End Sub

    Private Sub btnlimaringgit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlimaringgit.Click
        displaytext.Text = itotal
        itotal = itotal + 5
        displaytext.Text = Convert.ToString(itotal)
    End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox1.Text = itotal
        itotal = itotal + 0.1
        TextBox1.Text = itotal.ToString("0.00")
    End Sub

the problem is when i run the program and click the button it become like this: RM 1.2 not RM 1.20.
i also attach some pic
in the first pic the coin appear normally but after i click button RM 1.00 , it become like second pic.

hope some one can figure it out. thanks anyway.

Member Avatar for Unhnd_Exception
Private itotal As Double = 0

Private Sub btnseringgit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseringgit.Click
    displaytext.Text = itotal.ToString("#.00")
    itotal += 1
    displaytext.Text = itotal.ToString("#.00")
End Sub

Private Sub btnlimaringgit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlimaringgit.Click
    displaytext.Text = itotal.ToString("#.00")
    itotal += 5
    displaytext.Text = itotal.ToString("#.00")
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    TextBox1.Text = itotal.ToString("#.00")
    itotal += 0.1
    TextBox1.Text = itotal.ToString("#.00")
End Sub

thanks for the help :)

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.