Mr woody they are explaning on how to put the coding
And i am new to VB 6.0
Printable View
Mr woody they are explaning on how to put the coding
And i am new to VB 6.0
I can't believe the homework is still in progress. :rolleyes:
Sorry man - just couldn't resist. :p
You see i have a lot of things to do I can't complete it quick thats why i ask you Fellas To help me
And, we don't mind helping out at all. If we did, we wouldn't be here. It is just that rather than helping you through a coding problem, it appears that we are writing the code.
If you have some code that isn't working, then post it and someone will be more than happy to help you to get it working.
see thats what friends are for Right ?
VB Code:
[COLOR=Orange]Private Sub cmdcalculate_Click()[/COLOR] 'determine the price and amount due Dim intpieces As Integer Dim curprice As Currency Dim curamountearned As Currency intpieces = Val(txtpieces.Text) 'Validate for missing data and enable summary button after 'the first order has been entered If txtname.Text = "" Then MsgBox "Please Enter Name", vbOKOnly, "Data Entry Error" txtname.SetFocus ElseIf Not IsNumeric(txtpieces.Text) Then MsgBox "Please Enter a Positive Number for the Piece Count", _ vbOKOnly, "Data Entry Error" With txtpieces .Text = "" .SetFocus End With Else cmdsummary.[COLOR=DarkGreen]enable[/COLOR] = True
Is my CmdSummary Statement correct Or must i change to False Or something Else ? :confused:
And I Got This Error
Compile Error
Method Or Data Not found
On what line does the error occur?Quote:
Originally Posted by Franklin67
VB Code:
cmdsummary.enable = True
Line
You are missing a "d".Quote:
Originally Posted by Franklin67
VB Code:
cmdSummary.Enabled = True
VB Code:
calculate the pay cyramountearned = intpieces * curprice lblamountearned.Caption = FormatCurrency(curamountearned) 'add to totals mintpiecestotal = mintpiecestotal + intpieces mintemployeecount = mintemployeecount + 1 mcurpaytotal = mcurpaytotal + curamountearned End If
cyramountearned = intpieces * curprice
Now This line Has the error
How are each of the three defined?
cyramountearned = intpieces * curprice
SPELLING AGAIN! "u" not "y"
VB Code:
[COLOR=DarkGreen]lblamountearned[/COLOR].Caption = FormatCurrency(curamountearned)
Now This Line
Has the Error
Compile Error
Varible Not Defined
Which variable isn't defined?
lblamountearned or curamountearned?
lblamountearned
Quote:
Originally Posted by Franklin67
Then, that label doesn't exist. Put a lable on your form and call it that and you will be all set.Quote:
Originally Posted by Franklin67
where do i add
lblamountearned
In the new label ?
Put it on your form where it would seem to be the most appropriate.
What is it used for?
lblamountearned.Caption = FormatCurrency(curamountearned)
I mean where do i place this line To mY new label ?
What triggers that calculation?
VB Code:
'calculate the pay Curamountearned = intpieces * Curprice lblamountearned.Caption = FormatCurrency(Curamountearned) 'add to totals mintpiecesTotal = mintpiecesTotal + intpieces mintemployeecount = mintemployeecount + 1 Mcurpaytotal = Mcurpaytotal + Curamountearned End If
Ok. On the surface, this looks fine. What is the issue?
After i Created the new label inserted the coding inside it
mintpiecesTotal = mintpiecesTotal + intpieces
mintemployeecount = mintemployeecount + 1
Mcurpaytotal = Mcurpaytotal + Curamountearned
The one in the dark Green Is error
when i click the calculate button varible not defined
:confused: :wave:
Then, define itQuote:
Originally Posted by Franklin67
VB Code:
Dim mintemployeecount As Integer
Okay That Worked For Employee count
Only The total amout oF Money
Total pieces
Money (Per person)
average
Sumary button Does not work
What is the code and what are the errors?
VB Code:
Private Sub cmdcalculate_Click() 'Determined The Amount Due Dim intpieces As Integer Dim Curprice As Currency Dim Curamountearned As Currency intpieces = Val(txtpieces) 'Validate for missing data and enable summary button after 'the first order has been entered If txtname.Text = "" Then MsgBox "Please Enter Name", vbOKOnly, "Data Entry Error" txtname.SetFocus ElseIf Not IsNumeric(txtpieces.Text) Then MsgBox "Please Enter a Positive Number for the Piece Count", _ vbOKOnly, "Data Entry Error" With txtpieces .Text = " " .SetFocus End With Else cmdsummary.Enabled = True ' Find person with greatest number of pieces If intpieces > MintHighestpieces Then 'compare to current winner MintHighestpieces = intpieces Mstrhighname = txtname.Text End If 'find pay rate If intpieces < 200 Then Curprice = 0.5 ElseIf intpieces < 400 Then Curprice = 0.55 ElseIf intpieces < 600 Then Curprice = 0.6 Else Curprice = 0.65 End If 'calculate the pay Curamountearned = intpieces * Curprice lblamountearned.Caption = FormatCurrency(Curamountearned) 'add to totals mintpiecesTotal = mintpiecesTotal + intpieces Dim mintemployeecount As Integer Mcurpaytotal = Mcurpaytotal + Curamountearned End If End Sub Private Sub cmdexit_Click() End End Sub Private Sub cmdsummary_Click() 'Calculate the average and dispaly the totals Dim curaveragepay As Currency Dim strmessage As String curaveragepay = Mcurpaytotal / mintemployeecount strmessage = "Total number of pieces " & mintpiecesTotal & vbCrLf & _ "Average Pay: " & FormatCurrency(curaveragepay) & cbCrLf & _ "Person producing most: " & Mstrhighname & vbCrLf & _ " (produced " & MintHighestpieces & " pieces)" MsgBox strmessage, vbOKOnly, "Piecework Summary" End Sub Private Sub Form_Load() 'Initialise the variables MintHighestpieces = -1 End Sub Private Sub Label1_Click() 'calculate the pay Curamountearned = intpieces * Curprice lblamountearned.Caption = FormatCurrency(Curamountearned) End Sub
Half Of Them Are corrrect But I* don't know which one ? :confused:
When your program encounters an error, a message box will pop with the error message. I need to know what that is.
When you click on the debug button on the messagebox it will take you to the place where the error occured. I need to know what/where that is.
Private Sub Form_Load()
'Initialise the variables
MintHighestpieces = -1
End Sub
Error
Or Calculations
Franklin, saying Error does me no good.
What is the error?
There Is no error All is okay but i got the Dim mintemployeecount As Integer right When i click The Calculate Button Only The Name of the person & The number of pieces
It Gives the correct answer But Can't clear Off The number
and i need help with the rest
What is the rest that you need help with?
Only The total amout oF Money
Total pieces
Money (Per person)
average
Sumary button Does not work
What is the code in the summary button that does not work?
What should it be adding together to get a summary? (I need the variables you have created for this)
Here my Label Text boxes Names
lblaverage
lblmoney
lblpieces
Lbltotal money
Last One That Work Perfectly Okay : Lblblamountearned
Enter Name
Enter Number of pieces
Pieces Completed
1-199
200-399
400-599
600 Or more
Price Paid per Piece
$0.50
$0.55
$0.60
$0.65
summmary button
curaveragepay = Mcurpaytotal / mintemployeecount
strmessage = "Total number of pieces " & mintpiecesTotal & vbCrLf & _
"Average Pay: " & FormatCurrency(curaveragepay) & cbCrLf & _
"Person producing most: " & Mstrhighname & vbCrLf & _
" (produced " & MintHighestpieces & " pieces)"
MsgBox strmessage, vbOKOnly, "Piecework Summary"
Does not work
Ok. I have just read this thread and got completely confused.
Franklin67, you really, really must state exactly what code, errors or problems you are dealing with.
Just saying "it doesn't work", or posting a post like your very 1st one in this thread, is no good to anyone :(
I am still a little confused as to what your problem is.
A little tip for you. Add:
to the top of every module, class or form.VB Code:
Option Explicit
This will automatically let you know if you have no declared any varible.
VB can do this automatically when you create a new class or form. You can do this by going to Tools...Options...then tick "Require Varible Declaration"
Woof
What should it be adding together to get a summary? (I need the variables you have created for this)
Private Sub cmdsummary_Click()
'Calculate the average and dispaly the totals
Dim curaveragepay As Currency
Dim strmessage As String
curaveragepay = Mcurpaytotal / mintemployeecount
strmessage = "Total number of pieces " & mintpiecesTotal & vbCrLf & _
"Average Pay: " & FormatCurrency(curaveragepay) & cbCrLf & _
"Person producing most: " & Mstrhighname & vbCrLf & _
" (produced " & MintHighestpieces & " pieces)"
MsgBox strmessage, vbOKOnly, "Piecework Summary"
I don't where to put them ?
Can some check For me this and Then you will know what i mean
I am also Confused :confused: