Page 2 of 4 FirstFirst 1234 LastLast
Results 41 to 80 of 159

Thread: [RESOLVED] Piecework Visual Basic 6.0

  1. #41

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    you mean Erase The Select Case statement off the line ?

    Compile Error
    Expected End of the Line

  2. #42
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Piecework Visual Basic 6.0

    There's a world of difference between erase and move

  3. #43

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    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:

  4. #44
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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.

  5. #45

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    and move It where Hmmmm?

  6. #46
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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?

  7. #47
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Piecework Visual Basic 6.0

    Quote 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.

  8. #48

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    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 ?

  9. #49
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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. )
    Quote 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.

  10. #50
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Piecework Visual Basic 6.0

    I've made a few changes. See the comments

    VB Code:
    1. Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
    2.   Select Case lngTotalPcs
    3.   case 0 to 200 ' or whatever it should be for the next line
    4.     GetPayPerEmp = lngTotalPcs * 0.5
    5.   Case 200 To 299 ' this should be 399, or you won't get 300-399
    6.     GetPayPerEmp = lngTotalPcs * 0.55
    7.   Case 400 To 599
    8.     GetPayPerEmp = ingtotalpcs * 0.6
    9.   Case Is > 599
    10.     GetPayPerEmp = ingtotalpcs * 0.65
    11.   End select
    12. End Function

  11. #51

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    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 ?

  12. #52
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    You don't have to change it. Just add another Case statement to cover for it.

  13. #53

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    so just add another select case to the next line & The next line .......

  14. #54
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by Franklin67
    so just add another select case to the next line & The next line .......
    VB Code:
    1. Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
    2.   Select Case lngTotalPcs
    3.   case 0 to 200 ' or whatever it should be for the next line
    4.     GetPayPerEmp = lngTotalPcs * 0.5
    5.   Case 200 To 299 ' this should be 399, or you won't get 300-399
    6.     GetPayPerEmp = lngTotalPcs * 0.55
    7.   Case 300 To 399 'just a new case statement.  that is all
    8.     GetPayPerEmp = lngTotalPcs * whatever
    9.   Case 400 To 599
    10.     GetPayPerEmp = ingtotalpcs * 0.6
    11.   Case Is > 599
    12.     GetPayPerEmp = ingtotalpcs * 0.65
    13.   End Select
    14. End Function

  15. #55

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    how do i do that ?

  16. #56
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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:
    1. Case 300 To 399 'just a new case statement.  that is all
    2.     GetPayPerEmp = lngTotalPcs * whatever

  17. #57

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    so what should i add for the new case statement?

  18. #58
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Look at post #54

  19. #59

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    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:
    1. Case 300 To 399 'just a new case statement.  
    2.     GetPayPerEmp = lngTotalPcs 0.55

  20. #60
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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:
    1. Case 300 To 399 'just a new case statement.  
    2.     GetPayPerEmp = lngTotalPcs 0.55
    Yes. Or, you can just copy what I posted and overlay what you have now.

  21. #61

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    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

  22. #62
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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?

  23. #63

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    yes i have to use the 200 -399 But Now confused

  24. #64
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  25. #65

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    Jee Thanks Now I got it almost

  26. #66

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    'to calculate totals use this:
    VB Code:
    1. Private Sub cmdCalc_Click()
    2.  
    3.     'validate first textbox
    4.     With Text1
    5.         If Not IsNumeric(Trim(.Text)) Then
    6.             MsgBox "Invalid entry"
    7.             .SelStart = 0
    8.             .SelLength = Len(.Text)
    9.             .SetFocus
    10.             Exit Sub
    11.         End If
    12.     End With
    13.    
    14.     'validate second textbox
    15.     With Text2
    16.         If Not IsNumeric(Trim(.Text)) Then
    17.             MsgBox "Invalid entry"
    18.             .SelStart = 0
    19.             .SelLength = Len(.Text)
    20.             .SetFocus
    21.             Exit Sub
    22.         End If
    23.     End With
    24.    
    25.     'calculate total amount
    26.     txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00")
    27.  
    28. End Sub
    29.  
    30. 'to clear all of your texboxes use this:
    31. Private Sub cmdClear_Click()
    32. Dim txt As Control
    33.  
    34.     For Each txt In Me.Controls
    35.         If TypeOf txt Is TextBox Then
    36.             txt.Text = ""
    37.         End If
    38.     Next txt
    39.  
    40. 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.

  27. #67
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Piecework Visual Basic 6.0

    Looks OK to me.

  28. #68

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    VB Code:
    1. what  am i surpose to do now ?

  29. #69
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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:
    1. 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.

  30. #70

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    After i do post 66 what should i next?

  31. #71
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  32. #72

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    what i ment was after calclulating the totals what should i do ?

  33. #73
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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?

  34. #74

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    VB Code:
    1. 'to calculate totals use this:
    2. Private Sub cmdCalc_Click()
    3.  
    4.  
    5.     'validate first textbox
    6.     With Text1
    7.         If Not IsNumeric(Trim(.Text)) Then
    8.             MsgBox "Invalid entry"
    9.             .SelStart = 0
    10.             .SelLength = Len(.Text)
    11.             .SetFocus
    12.             Exit Sub
    13.         End If
    14.     End With
    15.         'validate second textbox
    16.     With Text2
    17.         If Not IsNumeric(Trim(.Text)) Then
    18.             MsgBox "Invalid entry"
    19.             .SelStart = 0
    20.             .SelLength = Len(.Text)
    21.             .SetFocus
    22.             Exit Sub
    23.         End If
    24.     End With
    25.         'calculate total amount
    26.     txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00")
    27.  
    28. End Sub


    Must i add this line to my summary and calculate button?

    Or only calculate button?

  35. #75
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Do you need a summary total?

  36. #76

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    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)

  37. #77
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Piecework Visual Basic 6.0

    Quote 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.

  38. #78

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Location
    Singapore
    Posts
    99

    Re: Piecework Visual Basic 6.0

    what do i do next?

  39. #79
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  40. #80
    Member
    Join Date
    Jun 2005
    Location
    Bolton, UK
    Posts
    42

    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.

Page 2 of 4 FirstFirst 1234 LastLast

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