|
-
May 13th, 2005, 09:59 AM
#1
Thread Starter
Junior Member
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:
Function Login(ByVal Username As String, ByVal Password As String) As Boolean
If Username = "pieuser1" And Password = "piepass1" Then
Login = True
End If
End Function
'Form1's code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim secondForm As New Form2 'Instantiate the second form
Dim username As Boolean
username = Login(Me.txtuser.Text, Me.txtpassword.Text)
If username = True Then
MessageBox.Show("You've successfully logged In!", _
"Verified User", MessageBoxButtons.OK, _
MessageBoxIcon.Information)
secondForm.ShowDialog() 'Show the second form
Else
MessageBox.Show("Try again - login information is incorrect!", _
"Access Denied", MessageBoxButtons.OK, _
MessageBoxIcon.Exclamation)
End If
End Sub
'Form2's code
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim total As Double
Dim sauce, serve, subtotal As Double
sauce = CDbl(txttomato.Text) * 0.5 + CDbl(txtbbq.Text) * 0.5 + CDbl(txtchilli.Text) * 0.5
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)))
total = subtotal + sauce
txttotal.Text = "RM" & Str(total)
End Sub
Sub serve(ByRef total As Double, ByRef serve As Double)
If raddine.Checked Then
serve = 0.1 * total
End If
If radtake.Checked Then
serve = 0.08 * total
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim change As Double
change = CDbl(txtpayment.Text) - CDbl(txttotal.Text)
txtchange.Text = "RM" & Str(change)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'To clear all the contents in text boxes
txtmeat.Clear()
txtveggie.Clear()
txtchicken.Clear()
txtcurry.Clear()
txtbeef.Clear()
txtcurry.Clear()
txtham.Clear()
txtpayment.Clear()
txtchange.Clear()
txttomato.Clear()
txtbbq.Clear()
txtchilli.Clear()
txttotal.Clear()
raddine.Checked = False
radtake.Checked = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|