i need help regarding the code.

the problem is when i try to make a new process payment.

here is the situation,

first, i click this button.
[IMG]http://i1120.photobucket.com/albums/l483/farid011/first-1.png[/IMG]

second, i click the payment button
[IMG]http://i1120.photobucket.com/albums/l483/farid011/second.png[/IMG]

third, i click balance button to calculate the payment and charge
[IMG]http://i1120.photobucket.com/albums/l483/farid011/third.png[/IMG]

fourth, i click this button to clear the display screen and want to make a new payment
[IMG]http://i1120.photobucket.com/albums/l483/farid011/fourth.png[/IMG]
[IMG]http://i1120.photobucket.com/albums/l483/farid011/fifth.png[/IMG]

fifth, i click again this button
[IMG]http://i1120.photobucket.com/albums/l483/farid011/first-1.png[/IMG]

sixth, i click again this button payment to make the payment but the number increase and it didnt return back to the usual
[IMG]http://i1120.photobucket.com/albums/l483/farid011/sixth.png[/IMG]

the problem are in button payment

here is the code

Public Class Form1
    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("0.00")
        itotal += 1
        displaytext.Text = itotal.ToString("0.00")
    End Sub

    Private Sub btnlimaringgit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlimaringgit.Click
        displaytext.Text = itotal.ToString("0.00")
        itotal += 5
        displaytext.Text = itotal.ToString("0.00")
    End Sub
    Private Sub btnticket_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnticket.Click
        ListBox1.Items.Add("                        Welcome                      ")
        ListBox1.Items.Add("                    To Zetro Parking                 ")
        ListBox1.Items.Add("")
        ListBox1.Items.Add("                  Please Insert Ticket               ")
        ListBox1.Items.Add(Date.Now.DayOfWeek.ToString)
        ListBox1.Items.Add("")
        Dim pay As Double
        Dim bayar As Double

        pay = "2.50"

        bayar = "3.50"

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

        If btnticket.Enabled = True Then
            btnsepuluhsen.Enabled = True
            btnduapuluhsen.Enabled = True
            btnlimapuluhsen.Enabled = True
            btnseringgit.Enabled = True
            btnlimaringgit.Enabled = True
            btnbalance.Enabled = True
            btnreset.Enabled = True
            btnsecurity.Enabled = True
            btnclear.Enabled = True
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        TextBox1.Text = TimeString
        TextBox2.Text = DateTime.Now.Date
    End Sub

    Private Sub btnsecurity_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsecurity.Click
        MessageBox.Show("The security will be arrived in a minute. We are apologize for the problem.", "Message")

    End Sub

    Private Sub btnreset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnreset.Click
        ListBox1.Items.Clear()
        ListBox1.Items.Add("")
        ListBox1.Items.Add("")
        ListBox1.Items.Add("Please take back your ticket")
        ListBox1.Items.Add("")
        ListBox1.Items.Add("Please bring the ticket to see the security")

    End Sub

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

        amount = displaytext.Text - TextBox3.Text

        If displaytext.Text > TextBox3.Text Then
            balancetext.Text = amount.ToString("0.00")
            ListBox1.Items.Add("Balance: " & amount.ToString("0.00"))
            ListBox1.Items.Add("Please take back your ticket")
            ListBox1.Items.Add("Thank You And Have A Nice Day")
        ElseIf displaytext.Text = TextBox3.Text Then
            balancetext.Text = amount.ToString("0.00")
            ListBox1.Items.Add("Balance: " & amount.ToString("0.00"))
            ListBox1.Items.Add("Please take back your ticket")
            ListBox1.Items.Add("Thank You And Have A Nice Day")
        End If

        If btnbalance.Enabled = True Then
            btnticket.Enabled = False
            btnsepuluhsen.Enabled = False
            btnduapuluhsen.Enabled = False
            btnlimapuluhsen.Enabled = False
            btnseringgit.Enabled = False
            btnlimaringgit.Enabled = False
        End If
    End Sub

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

    Private Sub btnduapuluhsen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnduapuluhsen.Click
        displaytext.Text = itotal.ToString("0.00")
        itotal += 0.2
        displaytext.Text = itotal.ToString("0.00")
    End Sub

    Private Sub btnlimapuluhsen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlimapuluhsen.Click
        displaytext.Text = itotal.ToString("0.00")
        itotal += 0.5
        displaytext.Text = itotal.ToString("0.00")
    End Sub

    Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
        ListBox1.Items.Clear()
        balancetext.Clear()
        displaytext.Clear()
        TextBox3.Clear()
        displaytext.Clear()

        If btnclear.Enabled = True Then
            btnticket.Enabled = True
            btnsepuluhsen.Enabled = False
            btnduapuluhsen.Enabled = False
            btnlimapuluhsen.Enabled = False
            btnseringgit.Enabled = False
            btnlimaringgit.Enabled = False
            btnbalance.Enabled = False
            btnreset.Enabled = False
            btnsecurity.Enabled = False
        End If
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        MsgBox("MOHD FARID BIN FAKARUDIN 07-200901-00019 FINAL PROJECT: AUTO PAY CAR PARK STATION")
    End Sub
End Class

i hope someone can solve this problem

thank you.

:D dude dont u use functions the project to the need to simplify with func. but then some1 reads the this long codes without getting bored and they can help u. but just w8 ill trying to understand 156line :D

i think u r new in software world :)

i give up its really very complex.As I said a little while ago u need to simplify this project with using functions
in my style i dont write same thinks again. if i notice i write same thinks then i ll write a function i use this .

for example

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

this lines
u need to build func like

private sub example(byval dayofweek as string ,byval TB as Textbox,byval LB as Listbox,byval py as double)

  TB.Text = pay.ToString("0.00")
    LB.Items.Add("Charge: " & py.ToString("0.00"))
end sub

   Private Sub btnlimaringgit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlimaringgit.Click
example(Date.Now.DayOfWeek.ToString,Textbox1,listbox1,pay)
example(Date.Now.DayOfWeek.ToString,Textbox2,listbox1,pay)
.
.
.

end sub

State the actual error you receive or observe and try some code simplification by breaking them down. That way, you can be more efficient in debugging your own codes

This article has been dead for over six months. Start a new discussion instead.