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.

Re: how to make a coin become decimal ? 80 80

I see you have basic knowledge of the language so i won't explain on how to implement, but take a look at this
http://msdn.microsoft.com/en-us/library/xfta99yt(v=VS.90).aspx

commented: Thank you for sharing the link. +13
Re: how to make a coin become decimal ? 80 80
Member Avatar
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
Re: how to make a coin become decimal ? 80 80

thanks for the help :)

Be a part of the DaniWeb community

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