Results 1 to 31 of 31

Thread: errr..Stuck?need help as soon as possible

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    27

    errr..Stuck?need help as soon as possible

    hi i am currently super stuck in one of my project as i am still not very used to PROGRAMMING...do not know how to fix the error....relli totally stuck...tried everything....so could some1 help me?

    The project is about a uni cake shop sells a selection of cakes to be bought for eating in and take away. Required to develop a solution that can be use as a point of sales register to record and calculate the amount ddue for individual orders and maintain accumulated totals of each type of cake sold, total number of orders, total revenu and total GST collected to create a summary of the day's sales. Payment is cash. GST charges is 8%, eat in service charge is 10% but not on take away. Extra cream; choc cream, strawberry and blueberry is 0.5 perpacket each.
    Requirements:
    login = 3 times only
    must show boolean flag variable
    multiform for login and order
    Before quiting display summary sales.
    And show number of order.
    require to use sub/fuction
    do not require database

    This is what i have done so far...which is like totally wrong i think..So pls...help me!!i relli reli tried my best...

    The error would most likely be the function on the form2's code


    VB Code:
    1. Function Login(ByVal Username As String, ByVal Password As String) As Boolean
    2.         If Username = "pieuser1" And Password = "piepass1" Then
    3.             Login = True
    4.         End If
    5.     End Function
    6.     'Form1's code
    7.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    8.         Dim secondForm As New Form2         'Instantiate the second form
    9.         Dim username As Boolean
    10.         username = Login(Me.txtuser.Text, Me.txtpassword.Text)
    11.         If username = True Then
    12.                 MessageBox.Show("You've successfully logged In!", _
    13.                 "Verified User", MessageBoxButtons.OK, _
    14.                 MessageBoxIcon.Information)
    15.                 secondForm.ShowDialog() 'Show the second form
    16.         Else
    17.                 MessageBox.Show("Try again - login information is incorrect!", _
    18.                 "Access Denied", MessageBoxButtons.OK, _
    19.                 MessageBoxIcon.Exclamation)
    20.         End If
    21.  
    22.     End Sub
    23. 'Form2's code
    24.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    25.         Dim total As Double
    26.         Dim sauce, serve, subtotal As Double
    27.         sauce = CDbl(txttomato.Text) * 0.5 + CDbl(txtbbq.Text) * 0.5 + CDbl(txtchilli.Text) * 0.5
    28.         subtotal = ((CDbl(txtmeat.Text) * CDbl(txtp1.Text) + CDbl(txtveggie.Text) * CDbl(txtp2.Text) + CDbl(txtchicken.Text) * CDbl(txtp3.Text) + CDbl(txtcurry.Text) * CDbl(txtp4.Text) + CDbl(txtbeef.Text) * CDbl(txtp5.Text) + CDbl(txtham.Text) * CDbl(txtp6.Text)))
    29.         total = subtotal + sauce
    30.         txttotal.Text = "RM" & Str(total)
    31.  
    32.     End Sub
    33.     Sub serve(ByRef total As Double, ByRef serve As Double)
    34.         If raddine.Checked Then
    35.             serve = 0.1 * total
    36.         End If
    37.         If radtake.Checked Then
    38.             serve = 0.08 * total
    39.         End If
    40.        
    41.     End Sub
    42.  
    43.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    44.         Dim change As Double
    45.         change = CDbl(txtpayment.Text) - CDbl(txttotal.Text)
    46.         txtchange.Text = "RM" & Str(change)
    47.  
    48.     End Sub
    49.  
    50.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    51.         'To clear all the contents in text boxes
    52.         txtmeat.Clear()
    53.         txtveggie.Clear()
    54.         txtchicken.Clear()
    55.         txtcurry.Clear()
    56.         txtbeef.Clear()
    57.         txtcurry.Clear()
    58.         txtham.Clear()
    59.         txtpayment.Clear()
    60.         txtchange.Clear()
    61.         txttomato.Clear()
    62.         txtbbq.Clear()
    63.         txtchilli.Clear()
    64.         txttotal.Clear()
    65.         raddine.Checked = False
    66.         radtake.Checked = False
    67.  
    68.     End Sub
    69.  
    70.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    71.         End
    72.  
    73.     End Sub
    74. End Class
    Last edited by RobDog888; May 13th, 2005 at 08:34 PM. Reason: Added vbcode tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width