0

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.

Edited by ayoba01: n/a

Attachments pic1.jpg 1.78 KB pic2.png 0.41 KB
3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by ayoba01
Featured Replies
  • I see you have basic knowledge of the language so i won't explain on how to implement, but take a look at this [url]http://msdn.microsoft.com/en-us/library/xfta99yt(v=VS.90).aspx[/url] Read More

0
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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.