[RESOLVED] Piecework Visual Basic 6.0-VBForums
Page 1 of 4 1234 LastLast
Results 1 to 40 of 159

Thread: [RESOLVED] Piecework Visual Basic 6.0

  1. #1

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

    Resolved [RESOLVED] Piecework Visual Basic 6.0

    Hi I have a project due soon and I am lost. Okay, I need to calculate & summarize the number of pieces completed



    See I am new to visual Basic

    Just a request Does anybody here Has the solution for piecework?
    Share on Google+

  2. #2
    Share on Google+

  3. #3

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

    Re: Piecework Visual Basic 6.0

    So Here's the full stats of my project

    I need to Use text Boxes To Obtain The person's name And the number Of pieces Completed



    and i also have to include a calculate button To display the total number of pieces Total Pay and the average pay Per person

    and include Validation To check for missing data


    and Of course The Clear Button

    and i need help with the coding


    Share on Google+

  4. #4
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Piecework Visual Basic 6.0

    Sorry, I'm still not following...
    Share on Google+

  5. #5
    Share on Google+

  6. #6

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

    Re: Piecework Visual Basic 6.0

    Calc Pay Menu Command

    Calculates and displays the dollar amount earned.



    Also, you need to make sure to not display the Summary form before any data is entered; you cannot calculate a total or an average when no items have been calculated. You can either check the number of employees or disable the Summary menu command until the first order has been calculated. If you choose to disable the Summary menu command, be sure to de-select the Enabled check box when setting it up in the Menu Editor. You will then need to enable it in your code at the right time.

    Summary Menu Command

    Summary Form

    The Summary form should display the summary information. The summary information is as follows:



    1. Total number of pieces

    2. Total number of employees

    3. Total pay for all employees

    4. Average pay for all employees



    The summary information should appear when the form is initially displayed. This form should also include two command buttons, a Back button and a Quit button. The Back button will close the Summary form and go back to the Main form. The Quit button will display a message box to make sure the user would really like to quit the program. If the user selects Yes, terminate the program. If the user selects No, close the Summary form and display the Main form.



    Displays the Summary form and all necessary summary information


    Pieces Completed
    1-199
    200-399
    400-599
    600 Or more




    Price Paid per Piece
    $0.50
    $0.55
    $0.60
    $0.65
    Last edited by Franklin67; Oct 2nd, 2005 at 09:38 AM.
    Share on Google+

  7. #7

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

    Re: Piecework Visual Basic 6.0

    The first Thing i Have to do

    Is create the text boxes and lables and text boxes

    Which i have already done



    Now only the coding part
    Share on Google+

  8. #8

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

    Re: Piecework Visual Basic 6.0

    I don't know what to do next?

    any ideas?
    Share on Google+

  9. #9

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

    Re: Piecework Visual Basic 6.0

    So, i have a calculate button. ,summary button. , clear button.

    and i am
    confused on how to make this work. Completely lost.... any help would be great
    Share on Google+

  10. #10
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Piecework Visual Basic 6.0

    OK, say you have two textboxes Text1 and Text2 and you want to calculate the toal amount and output it in another textbox say txtTotal:
    VB Code:
    1. 'to calculate totals use this:
    2. Private Sub cmdCalc_Click()
    3.  
    4.     'validate first textbox
    5.     With Text1
    6.         If Not IsNumeric(Trim(.Text)) Then
    7.             MsgBox "Invalid entry"
    8.             .SelStart = 0
    9.             .SelLength = Len(.Text)
    10.             .SetFocus
    11.             Exit Sub
    12.         End If
    13.     End With
    14.    
    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.    
    26.     'calculate total amount
    27.     txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00")
    28.  
    29. End Sub
    30.  
    31. 'to clear all of your texboxes use this:
    32. Private Sub cmdClear_Click()
    33. Dim txt As Control
    34.  
    35.     For Each txt In Me.Controls
    36.         If TypeOf txt Is TextBox Then
    37.             txt.Text = ""
    38.         End If
    39.     Next txt
    40.  
    41. End Sub
    Share on Google+

  11. #11

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

    Re: Piecework Visual Basic 6.0

    But how do i calculate The dollar amount earned ?



    Now the summary button to display the total number of pieces the total pay and the average pay per person

    How do i do that ?
    Share on Google+

  12. #12
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by Franklin67
    But how do i calculate The dollar amount earned ?
    Just multiply values from two textboxes - isn't that a simple math?
    VB Code:
    1. txtTotal.Text = Format(CLng(Text1.Text) * CCur(Text1.Text), "$0.00")
    In the sample above Text1 textbox represents "Pieces Completed" and Text2 - "Price Paid per Piece"
    Share on Google+

  13. #13

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

    Re: Piecework Visual Basic 6.0

    How about the pieces and the summary button ?

    1-199 Pieces completed the price per piece is $.50
    200-399 Pieces completed the price per piece is $.55
    400-599 Pieces completed the price per piece is $.60
    600+ Pieces completed the price per piece is $.65
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    Then, using the power of common sense, you obviously have to tally first the total quantity completed (and store its value in a variable) before doing additional computations involving rate per piece.
    Share on Google+

  15. #15

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

    Re: Piecework Visual Basic 6.0

    can you show me how to do that?

    and my maths is weak
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    That's not an excuse unless ..... is VB being taught in elementary nowadays?

    Come on! A little effort on your part pls.

    You get the totalpcs with addition
    You then multiply this with any of the four rates (0.5, 0.55, 0.6, 0.65) with a select case structure or an if...then...elseif structure, I suggest you use the select case.

    All the info is available in MSDN. For now you need to look up the syntax and use of select case

    Also by looking up msdn, you might come across other info you will need for this assignment. Instead of asking about every single detail.
    Last edited by leinad31; Oct 2nd, 2005 at 11:37 AM.
    Share on Google+

  17. #17

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

    Re: Piecework Visual Basic 6.0

    well just read the attachment file and help me out
    Attached Files Attached Files
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    To perform the pay calculation:
    Use a function procedure to find the pay rate and return a value to the proper event procedure.

    VB Code:
    1. Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency
    2.  
    3.  
    4. Select Case lngTotalPcs
    5. Case 1 To 199
    6.    GetPayPerEmp = lngTotalPcs * 0.5
    7. Case 200 To 299
    8.    GetPayPerEmp = lngTotalPcs * 0.55
    9. etc etc
    10. End Select
    11.  
    12. End Function

    Your not gonna learn if your too lazy to do read just 2 pages about select case
    Last edited by leinad31; Oct 3rd, 2005 at 08:52 AM.
    Share on Google+

  19. #19
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by Franklin67
    well just read the attachment file and help me out
    Somewhat off topic: A humble attidude will get you further in life

    on topic: I'll try to code something later tonight, I just need to get in vb-mood
    Share on Google+

  20. #20
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by JensPeder
    Somewhat off topic: A humble attidude will get you further in life

    on topic: I'll try to code something later tonight, I just need to get in vb-mood
    OFF TOPIC: your "on topic" promise shouldn't really be there - we don't do homeworks for anybody - we try to help to solve some particular problem(s) unless it's some "major issue" which is obviously NOT the case here.
    Share on Google+

  21. #21

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

    Re: Piecework Visual Basic 6.0

    no what i ment was only the coding not the whole thing
    Share on Google+

  22. #22
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,958

    Re: Piecework Visual Basic 6.0

    I can't believe how many people use these forums to do their homework for them...
    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.
    Share on Google+

  23. #23

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

    Re: Piecework Visual Basic 6.0

    Okay Check whether i got this correct
    VB Code:
    1. Private Sub CmdSummary_Click()
    2.  
    3.  
    4. Dim curAverage As Currency
    5. Dim intQuantity As Integer
    6. Dim curAmount As Currency
    7. Dim strMessageString As String
    8. Dim strFormattedAvg As String
    9. Dim strFormattedPay As String
    10. Dim curPrice As Currency
    11. [COLOR=DarkGreen]'Display a summary message box[/COLOR]
    12.  
    13. intQuantity = Val(txtPieces.Text)
    14. curAmount = intQuantity * curPrice
    15. [COLOR=Red] lblAmount.Caption =  FormatCurrency(curAmount, 2)  cmdCalculate. Enabled =  False[/COLOR]
    16. mintTotalNumber = mintTotalNumber + intQuantity
    17. mcurTotalPay = mcurTotalPay + curAmount
    18. mintCustomerCount = mintCustomerCount + 1
    19. curAverage = mcurTotalPay / mintCustomerCount
    20.  
    21.  
    22. [COLOR=DarkGreen]'Format the numbers[/COLOR]
    23.  
    24. strFormattedAvg = FormatCurrency(curAverage, 2)
    25. strFormattedPay = FormatCurrency(mcurTotalPay, 2)
    26. [COLOR=Red]strMessageString = "Total number of pieces: " & mintTotalNumber & vbCrLf & _
    27. "Total Pay: " & strFormattedPay & vbCrLf & _[/COLOR]
    28.  
    29. "Average Pay: " & strFormattedPay
    30. MsgBox strMessageString, vbInformation, "Piecework summary"
    31.  
    32. [COLOR=Red]public Function GetPayPerEmp ingTotalPcs As Long)As Currency Select Case lngTotalPcs.[/COLOR]  {How com i got this in red ?
    33.  
    34. Case 1 To 199
    35.    GetPayPerEmp = lngTotalPcs * 0.5
    36. Case 200 To 299
    37.    GetPayPerEmp = lngTotalPcs * 0.55
    38.  
    39. Case 400 To 599
    40.  GetPayPerEmp = ingtotalPcs * 0.60
    41.  
    42.    Case 600 Or more
    43.    GetPayPerEmp = ingtotal * 0.65
    44. End Select
    45.  
    46. End Function
    47. End Sub




    Edit: Added [vbcode][/vbcode] tags for clarity. - Hack
    Last edited by Hack; Oct 3rd, 2005 at 07:50 AM.
    Share on Google+

  24. #24
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by Franklin67
    Okay Check whether i got this correct
    Run it, and tell us if it comes back with the right answer.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
    Share on Google+

  25. #25

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

    Re: Piecework Visual Basic 6.0

    Only those in the red are giving problem
    Share on Google+

  26. #26
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Piecework Visual Basic 6.0

    VB Code:
    1. 'missing parenthese here
    2. public Function GetPayPerEmp ingTotalPcs As Long)As Currency
    3. 'should be
    4. public Function GetPayPerEmp [color=blue][b]([/b][/color][b][/b]ingTotalPcs As Long)As Currency
    VB Code:
    1. 'these need to be on different lines
    2. 'not
    3.  lblAmount.Caption =  FormatCurrency(curAmount, 2)  cmdCalculate. Enabled =  False
    4. 'but
    5.  lblAmount.Caption =  FormatCurrency(curAmount, 2)  
    6. cmdCalculate. Enabled =  False
    VB Code:
    1. 'got one too many lines here
    2. 'not
    3. strMessageString = "Total number of pieces: " & mintTotalNumber & vbCrLf & _
    4. "Total Pay: " & strFormattedPay & vbCrLf & _
    5.  
    6. "Average Pay: " & strFormattedPay
    7. MsgBox strMessageString, vbInformation, "Piecework summary"
    8. 'but
    9. strMessageString = "Total number of pieces: " & mintTotalNumber & vbCrLf & _
    10. "Total Pay: " & strFormattedPay & vbCrLf & _
    11. "Average Pay: " & strFormattedPay
    12. MsgBox strMessageString, vbInformation, "Piecework summary"
    Last edited by Hack; Oct 3rd, 2005 at 08:23 AM.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    You don't declare a procedure (the function) within another procedure (the sub)

    VB Code:
    1. Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency
    2. '''
    3.  
    4. Select Case lngTotalPcs.  
    5. Case 1 To 199
    6.    GetPayPerEmp = lngTotalPcs * 0.5
    7. Case 200 To 299
    8.    GetPayPerEmp = lngTotalPcs * 0.55
    9.  
    10. Case 400 To 599
    11.  GetPayPerEmp = ingtotalPcs * 0.60
    12.  
    13. Case Is > 599
    14.    GetPayPerEmp = ingtotal * 0.65
    15. End Select
    16.  
    17. End Function

    To call this elsewhere, such in CmdSummary_Click() procedure you do:

    Dim CalculatedPay As Currency
    Dim lngSampleVar As Currency

    'Let's assume 150 pcs to be used as parameter for the function call stored in variable lngSampleVar
    lngSampleVar = 150 'assigned 150 based on previous calculations
    CalculatedPay = GetPayPerEmp(lngSampleVar)
    'CalculatedPay would then become equal to 75 because thats the value returned by the function call
    Last edited by leinad31; Oct 3rd, 2005 at 10:00 AM.
    Share on Google+

  28. #28
    Addicted Member JensPeder's Avatar
    Join Date
    Sep 2005
    Posts
    249

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by RhinoBull
    OFF TOPIC: your "on topic" promise shouldn't really be there - we don't do homeworks for anybody - we try to help to solve some particular problem(s) unless it's some "major issue" which is obviously NOT the case here.
    Well, I never ment to make a complete program, just read the description and guide the guy a little bit. He should of course try to do most of it himself, but its he's completely lost its nice to get some guidance on how to tackle the assignement
    Share on Google+

  29. #29

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

    Re: Piecework Visual Basic 6.0

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
    (ONLY THis one)


    Dim curAverage As Currency
    Dim intQuantity As Integer
    Dim curAmount As Currency
    Dim strMessageString As String
    Dim strFormattedAvg As String
    Dim strFormattedPay As String
    Dim curPrice As Currency
    Dim CalculatedPay As Currency
    Dim lngSampleVar As Currency


    'Display a summary message box

    intQuantity = Val(txtPieces.Text)
    curAmount = intQuantity * curPrice

    mintTotalNumber = mintTotalNumber + intQuantity
    mcurTotalPay = mcurTotalPay + curAmount
    mintCustomerCount = mintCustomerCount + 1
    curAverage = mcurTotalPay / mintCustomerCount


    'Format the numbers

    strFormattedAvg = FormatCurrency(curAverage, 2)
    strFormattedPay = FormatCurrency(mcurTotalPay, 2)
    strMessageString = "Total number of pieces: " & mintTotalNumber & vbCrLf & _
    "Total Pay: " & strFormattedPay & vbCrLf & _
    lblAmount.Caption = FormatCurrency(curAmount, 2)
    CmdCalculate.Enabled = False

    strMessageString = "Total number of pieces: " & mintTotalNumber & vbCrLf & _
    "Total Pay: " & strFormattedPay & vbCrLf & _
    "Average Pay: " & strFormattedPay
    MsgBox strMessageString, vbInformation, "Piecework summary"


    Private Sub Cmdcalculate_Click()

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
    Case 1 To 199
    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

    and now am i missing anything ?
    Last edited by Franklin67; Oct 3rd, 2005 at 10:10 AM.
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    there's something wrong with the vbcode tags, the function declaration ought to finish with as currency, select case should be on the next line. I had to insert comment characters to get them to go to the next line.

    And the function is declared separately... not nested in the sub procedures declaration

    Private Sub Cmdcalculate_Click()
    ...
    End Sub

    Public Function etc...
    ...
    End Function
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    Oh btw, I believe your gonna use that only for the pay per employee (total pcs sold by employee to get corresponding pay given to him). For the summary form, the computations are different. You get the totals including totals of pay per employee and then divide to get the average.
    Share on Google+

  32. #32

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

    Re: Piecework Visual Basic 6.0

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.

    This one gives me the error

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
    Case 1 To 199
    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 Sub
    End Function

    where do i put Public Function
    &
    End Function ?

    did i miss anything else ?
    Last edited by Franklin67; Oct 3rd, 2005 at 10:33 AM.
    Share on Google+

  33. #33
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by Franklin67
    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.

    This one gives me the error

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
    Case 1 To 199
    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 Sub
    End Function

    Public Function
    End Function

    did i miss anything else ?
    VB Code:
    1. 'again, you have a run on line
    2. 'not
    3. Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs
    4. 'but
    5. Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency
    6.  
    7. Select Case lngTotalPcs
    8. 'then all your Case statements follow this
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    Read up regarding procedures pls. definition, types, samples etc
    Share on Google+

  35. #35

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

    Re: Piecework Visual Basic 6.0

    so you mean i must put this on every line ?

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    No No no That should be two lines.

    THERS SOMETHING WRONG WITH THE PARSING OF THE VBCODE TAGS

    I had to insert the comment char ''' just to keep them from running on the same line.

    "Select Case" should be on a new line.

    But aside from that you have no idea on the poper declaration of procedures... your nesting them in your code. Please read up on procedures, its definition, the types of procedures, etc so you can understand better what I was trying to point out.
    Share on Google+

  37. #37

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

    Re: Piecework Visual Basic 6.0

    I don't understand Could you show me an example?
    Share on Google+

  38. #38
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Piecework Visual Basic 6.0

    Quote Originally Posted by Franklin67
    so you mean i must put this on every line ?

    Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs


    You don't need to put anything anywhere. Just move the Select Case statement off of the line on which you are declaration your Function.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
    Share on Google+

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

    Re: Piecework Visual Basic 6.0

    A sample won't suffice, you have to read up on it otherwise all were trying to say would sound greek to you.
    Share on Google+

  40. #40

    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 .
    Share on Google+

Page 1 of 4 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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.