-
Oct 3rd, 2005, 09:58 AM
#41
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
you mean Erase The Select Case statement off the line ?
Compile Error
Expected End of the Line
-
Oct 3rd, 2005, 10:04 AM
#42
Re: Piecework Visual Basic 6.0
There's a world of difference between erase and move
-
Oct 3rd, 2005, 10:08 AM
#43
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
How Do I Move The select case stement off the line
Compile Error
Expected End of the line :Confused:
-
Oct 3rd, 2005, 10:09 AM
#44
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
How Do I Move The select case stement off the line
Compile Error
Expected End of the line :Confused:
Put your curosr under the S of Select and hit the Enter key.
-
Oct 3rd, 2005, 10:32 AM
#45
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
-
Oct 3rd, 2005, 10:34 AM
#46
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
and move It where Hmmmm?
Move it nowhere.
Just get it off the same line as your Function declaration. If put your cursor under the S in Select and hit enter, you should be just fine.
Are you familiar with the structure of Functions or the structure of Select Case statements?
-
Oct 3rd, 2005, 10:38 AM
#47
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
and move It where Hmmmm?
We're already being patient and trying to explain as best as we could given the fact that your slow on the pickup. But it's not entirely dependent on us.
"Help us help you" so to speak.
-
Oct 3rd, 2005, 10:46 AM
#48
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
Like This ?
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
Select Case lngTotalPcs
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End Function
End Function
what should i do next ?
-
Oct 3rd, 2005, 10:52 AM
#49
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
Like This ?
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
Select Case lngTotalPcs
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End Function
You got it (except for an extra End Function. You only need one of those. )
Originally Posted by Franklin67
what should i do next ?
I have no idea what this means, but as far as building your function goes, you don't have to do anything next.
-
Oct 3rd, 2005, 10:53 AM
#50
Re: Piecework Visual Basic 6.0
I've made a few changes. See the comments
VB Code:
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
Select Case lngTotalPcs
case 0 to 200 ' or whatever it should be for the next line
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299 ' this should be 399, or you won't get 300-399
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End select
End Function
-
Oct 3rd, 2005, 11:00 AM
#51
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
and thats all what's next
Case 200 To 299 ' this should be 399, or you won't get 300-399
Change the 299 to 399 ?
-
Oct 3rd, 2005, 11:01 AM
#52
Re: Piecework Visual Basic 6.0
You don't have to change it. Just add another Case statement to cover for it.
-
Oct 3rd, 2005, 11:10 AM
#53
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
so just add another select case to the next line & The next line .......
-
Oct 3rd, 2005, 11:35 AM
#54
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
so just add another select case to the next line & The next line .......
VB Code:
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
Select Case lngTotalPcs
case 0 to 200 ' or whatever it should be for the next line
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299 ' this should be 399, or you won't get 300-399
GetPayPerEmp = lngTotalPcs * 0.55
Case 300 To 399 'just a new case statement. that is all
GetPayPerEmp = lngTotalPcs * whatever
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End Select
End Function
-
Oct 3rd, 2005, 06:23 PM
#55
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
-
Oct 3rd, 2005, 06:27 PM
#56
Re: Piecework Visual Basic 6.0
Add this between 200 and 400, and supply the coreect whatever value.
Unless 300-399 uses the same price as 200-299, in which case you can just change the other statement like I said earlier. If you leave it out, then nothing will be multiplied as a case wouldn't be found
VB Code:
Case 300 To 399 'just a new case statement. that is all
GetPayPerEmp = lngTotalPcs * whatever
-
Oct 4th, 2005, 03:32 AM
#57
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
so what should i add for the new case statement?
-
Oct 4th, 2005, 06:55 AM
#58
Re: Piecework Visual Basic 6.0
-
Oct 4th, 2005, 07:17 AM
#59
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
Case 200 To 299 ' this should be 399, or you won't get 300-399
(So this is what i have to type in)
VB Code:
Case 300 To 399 'just a new case statement.
GetPayPerEmp = lngTotalPcs 0.55
-
Oct 4th, 2005, 07:20 AM
#60
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
Case 200 To 299 ' this should be 399, or you won't get 300-399
(So this is what i have to type in)
VB Code:
Case 300 To 399 'just a new case statement.
GetPayPerEmp = lngTotalPcs 0.55
Yes. Or, you can just copy what I posted and overlay what you have now.
-
Oct 4th, 2005, 08:12 AM
#61
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
so you mean i don't have to change anything except for the 300 and 399
But just leave the 200 alone
-
Oct 4th, 2005, 08:13 AM
#62
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
so you mean i don't have to change anything except for the 300 and 399
But just leave the 200 alone
Is the 200 doing what you need it to do?
-
Oct 4th, 2005, 09:29 PM
#63
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
yes i have to use the 200 -399 But Now confused
-
Oct 4th, 2005, 09:34 PM
#64
Re: Piecework Visual Basic 6.0
If the price is the same for 200-399, then you don't have to insert another case statement, you can just change your code from 200-299 to 200-399 and it will work fine.
-
Oct 4th, 2005, 09:53 PM
#65
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
Jee Thanks Now I got it almost
-
Oct 5th, 2005, 01:01 AM
#66
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
'to calculate totals use this:
VB Code:
Private Sub cmdCalc_Click()
'validate first textbox
With Text1
If Not IsNumeric(Trim(.Text)) Then
MsgBox "Invalid entry"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
Exit Sub
End If
End With
'validate second textbox
With Text2
If Not IsNumeric(Trim(.Text)) Then
MsgBox "Invalid entry"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
Exit Sub
End If
End With
'calculate total amount
txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00")
End Sub
'to clear all of your texboxes use this:
Private Sub cmdClear_Click()
Dim txt As Control
For Each txt In Me.Controls
If TypeOf txt Is TextBox Then
txt.Text = ""
End If
Next txt
End Sub
so this is what i have to type in to the command button?
Help me i am stuck
Edit: Added [vbcode][/vbcode] tags for clarity. - Hack
Last edited by Hack; Oct 5th, 2005 at 05:26 AM.
-
Oct 5th, 2005, 01:10 AM
#67
Re: Piecework Visual Basic 6.0
-
Oct 5th, 2005, 01:16 AM
#68
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
VB Code:
what am i surpose to do now ?
-
Oct 5th, 2005, 02:14 AM
#69
Re: Piecework Visual Basic 6.0
double-click on your total button. if it's named the same, it should jump to this line:
VB Code:
Private Sub cmdCalc_Click()
if you have it named something else, then copy the code below that line in your example into the sub, but make sure that you only have one END SUB at the bottom. Include the second sub, if you need it. It belongs after the first END SUB. Place OPTION EXPLICIT at the top of each form to catch undeclared variable errors, and if you have anything named correctly it will let you know.
-
Oct 5th, 2005, 03:00 AM
#70
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
After i do post 66 what should i next?
-
Oct 5th, 2005, 05:28 AM
#71
Re: Piecework Visual Basic 6.0
This isn't our application. How are we to know what you are supposed to do next?
After you calculate the total, what do you/the application need to happen next?
-
Oct 5th, 2005, 07:28 AM
#72
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
what i ment was after calclulating the totals what should i do ?
-
Oct 5th, 2005, 07:32 AM
#73
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
what i ment was after calclulating the totals what should i do ?
My point is, I don't know what you should do because I don't know what your program is supposed to do.
What is your program supposed to do after the calculations have been done?
Anything?
-
Oct 5th, 2005, 08:38 AM
#74
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
VB Code:
'to calculate totals use this:
Private Sub cmdCalc_Click()
'validate first textbox
With Text1
If Not IsNumeric(Trim(.Text)) Then
MsgBox "Invalid entry"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
Exit Sub
End If
End With
'validate second textbox
With Text2
If Not IsNumeric(Trim(.Text)) Then
MsgBox "Invalid entry"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
Exit Sub
End If
End With
'calculate total amount
txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00")
End Sub
Must i add this line to my summary and calculate button?
Or only calculate button?
-
Oct 5th, 2005, 08:41 AM
#75
Re: Piecework Visual Basic 6.0
Do you need a summary total?
-
Oct 5th, 2005, 08:55 AM
#76
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
Yes i need to have a summary total to
1 To display the Total Number of pieces
2.The Total Pay
3.Average Pay per person
and i need a Clear button to clear the name and the number of pieces for the current employee (If You what I mean)
-
Oct 5th, 2005, 08:57 AM
#77
Re: Piecework Visual Basic 6.0
Originally Posted by Franklin67
Must i add this line to my summary and calculate button?
Or only calculate button?
Based on what you just said, then, the answer is yes.
-
Oct 6th, 2005, 05:29 AM
#78
Thread Starter
Lively Member
Re: Piecework Visual Basic 6.0
-
Oct 6th, 2005, 05:33 AM
#79
Re: Piecework Visual Basic 6.0
Why do I get the ever present feeling that the people on this forum are writing this program, not you.
What do you think you should/need to do next?
-
Oct 6th, 2005, 06:10 AM
#80
Member
Re: Piecework Visual Basic 6.0
The people on this forum ARE writing his program for him. the next time he gets some homework, he'll be back with no code of his own.
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
|