hello

good afternoon

i have a problem regarding the number and want the number become from this: RM 2 to be like this: RM 2.00

here is the code:

Dim pay As Double
        Dim bayar As Double

        pay = "2.00"

        bayar = "3.00"

        If Date.Now.DayOfWeek.ToString = "Monday" Then
            TextBox3.Text = pay
            ListBox1.Items.Add("Charge: " & pay)
        ElseIf Date.Now.DayOfWeek.ToString = "Tuesday" Then
            TextBox3.Text = pay
            ListBox1.Items.Add("Charge: " & pay)
        ElseIf Date.Now.DayOfWeek.ToString = "Wednesday" Then
            TextBox3.Text = pay
            ListBox1.Items.Add("Charge: " & pay)
        ElseIf Date.Now.DayOfWeek.ToString = "Thursday" Then
            TextBox3.Text = pay
            ListBox1.Items.Add("Charge: " & pay)
        ElseIf Date.Now.DayOfWeek.ToString = "Friday" Then
            TextBox3.Text = bayar
            ListBox1.Items.Add("Charge: " & bayar)
        ElseIf Date.Now.DayOfWeek.ToString = "Saturday" Then
            TextBox3.Text = bayar
            ListBox1.Items.Add("Charge: " & bayar)
        ElseIf Date.Now.DayOfWeek.ToString = "Sunday" Then
            TextBox3.Text = bayar
            ListBox1.Items.Add("Charge: " & bayar)
        End If

and also when calculate the paid and the result of the balance are not in decimal, like this: RM 2 , not RM 2.00

here is the code:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim amount As Double

        amount = TextBox1.Text - TextBox2.Text

        If TextBox1.Text > TextBox2.Text Then
            ListBox1.Items.Add("Balnce: " & amount)

        End If
    End Sub

Recommended Answers

All 3 Replies

Hi,

You can try something like this:

ListBox1.Items.Add("Balnce: " & amount). ToString("0.00")

thanks for the help. the code is working. thanks again!!! :D

Hi,

No problem :)
Mark your thread as resolved, rating is a way of saying thank you! :)

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.