Page 1 of 2 12 LastLast
Results 1 to 40 of 78

Thread: [RESOLVED] i need help with this program i have no clue what to do

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Resolved [RESOLVED] i need help with this program i have no clue what to do

    i need to have this done in the next few hours but i have no idea how to do all these dam functions...here is what i need done

    When a commission is given for a salesperson his or her percent of total sales should also be given
    add a summary command button. when it is clicked, total sales, total profit, and average commission will be placed on the form. the calculate command button should be the default button. the clear command button should be the cancel button. make sure to document the project with remark statements. use the naming rules and conventions studied
    Put to use the following items:
    tool tips
    access keys
    enabled property
    tab order and setting focus during execution
    formatting functions
    accumulators



    VB Auto Center
    Salespeople for the used are compensated using a commission system. the commission is based on the costs incured for the vehicle
    Commission =
    Commission rate X (Sales price - Cost value)

    the screen will allow the user to enter the salesperson's name, the selling price of the vehicle, and the cost of the vehicle. Use a constant of 20 percent for the commission rate.

    The Calculate command button will determine the commission earned by the salesperson; the Clear button will clear the text boxes. a Print Form button will be available ONLY after the calculation has been made. it will be disabled untill the Calculate button has been pressed the first time. When the Clear button is pressed, the Print Form button will become disabled.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: i need help with this program i have no clue what to do

    Sorry we don't do people's homework on this forum.

    I am sure you had more than just a "few hours" to do this project, I don't know why you waited until the last minute, however that is neither here nor there. We just don't do homework for people.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    let me be more specific on what i need help with, i need the syntax for a command button, that when i press it the contents of a text box - the contents of another text box is multiplied by 20, and that is put into a lbl box

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: i need help with this program i have no clue what to do

    what do you have done so far? please post the code you have come up with, and I am sure people on here will be more than happy to help you.

    The "problem", if you want to call it that, is people on here LOVE to help, but they don't like to do all the work for you. If you show effort being put forward, you will likely get the help you need.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    i have the layout all my command buttons are down i have the text boxes made lbl box is made but i don't know the syntax to put on cmdCalculate so it will do lblCommission.Caption = 20% * (txtsales.Text - txtCost.txt) whats the syntax to get it to do that? is what i want to know, got the print form button working not sure about the clear button it's supposed to clear the values of the text boxes...but idk how i'll check up on that later....thats all i really don't understand for now

    Edit: also clear is set as cancel button and calculate is set as default button
    Last edited by Newtonx; Jan 2nd, 2007 at 02:00 PM.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    VB 6.0 btw

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: i need help with this program i have no clue what to do

    ok, then you are in the wrong forum. I will move this for you.

  8. #8
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    In the form view, double click your command button to create the Command_Click event. Inside that sub, put the code for your computation. Easy as that.

  9. #9
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Untested:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub cmdCalculate_Click()
    4.     lblCommission.Caption = CStr((txtsales.Text - txtCost.Text) * 0.2)
    5. End Sub

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    yes but what is the syntax for the code i don't know the formatting function i have to put with it and sorry for the wrong forum, nice 127.0.0.1 ip no place like home definatly true

  11. #11
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    Why set it as a string? A label's Caption property understands numbers perfectly well, and you might want to keep it as a number in case you need to use it later.

  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: i need help with this program i have no clue what to do

    You may also want to add some error handling incase someone enters values that are not valid to compute... like entering letters where they should enter numbers..

  13. #13
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    If the TextBox's are NOT in a Control Array, then:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub cmdClear_Click()
    4. Dim ctl As Control
    5.  
    6.     For Each ctl In Controls
    7.         If TypeOf ctl Is TextBox Then ctl.Text = vbNullString
    8.     Next
    9.  
    10. End Sub

  14. #14
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    Here:
    VB Code:
    1. Private Sub cmdCalculate_Click()
    2.    lblCommision.Caption = Round(((CDbl(txtsales.Text) - CDbl(txtCost.Text)) * 0.2), 2)
    3. End Sub

    That will calculate and round to two places, to keep it as a currency value.

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by Bruce Fox
    Untested:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub cmdCalculate_Click()
    4.     lblCommission.Caption = CStr((txtsales.Text - txtCost.Text) * 0.2)
    5. End Sub
    it doesn't like the .Text on either sales or cost

  16. #16
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by kleinma
    You may also want to add some error handling incase someone enters values that are not valid to compute... like entering letters where they should enter numbers..
    Easy solution.

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by timeshifter
    Here:
    VB Code:
    1. Private Sub cmdCalculate_Click()
    2.    lblCommision.Caption = Round(((txtsales.Text - txtCost.Text) * 0.2), 2)
    3. End Sub

    That will calculate and round to two places, to keep it as a currency value.
    also doesn't like the .Text on either, i am so confused

  18. #18
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    See my previous post. Just appended it to solve that problem.

  19. #19
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by timeshifter
    Why set it as a string? A label's Caption property understands numbers perfectly well
    Because the Caption data type is a String. Casting it to a String is the correct way to do it.
    TextBoxes default is .Text and you dont have to use it, but I always explicitly use Text1.Text, as in VB.Net there is no default - just good practice

  20. #20
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    True, but the value will automatically get passed as a string when it's set as the Caption or Text property.

  21. #21
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by Bruce Fox
    Because the Caption data type is a String. Casting it to a String is the correct way to do it.
    TextBoxes default is .Text and you dont have to use it, but I always explicitly use Text1.Text, as in VB.Net there is no default - just good practice
    especially if you plan to move to .NET where they have implement strict casting so you can add two numeric strings together without first casting them as numbers.

    Sure you can turn option strict off, but I wouldn't recommend it.

  22. #22
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Is txtsales a Variable, or a TextBox?

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    Private Sub cmdCalculate_Click(Index As Integer)
    lblCommision.Caption = Round(((CDbl(txtSales.Text) - CDbl(txtCost.Text)) * 0.2), 2)
    End Sub
    it highlights the Private Sub cmdCalculate_Click(Index As Integer) in yellow and the .Text in blue still an error..should i create a new project and try it?

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by Bruce Fox
    Is txtsales a Variable, or a TextBox?
    text box

  25. #25
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Are the TextBox's on the same Form as the CommandButton?

    If so, what is the Error?

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    i remade it just putting a txtCost and txtSales as text boxes, and cmdCalculate as the command button and lblCommission as the label button, still nogo

  27. #27
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    Zip up your project files and post them up so we can see what's going on. There are any number of things that could be throwing your program off.

  28. #28

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    Compile Error
    Method or data not found!
    thats what i get when it highlights when i try to execute the calculate button

  29. #29

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    Quote Originally Posted by timeshifter
    Zip up your project files and post them up so we can see what's going on. There are any number of things that could be throwing your program off.
    how do i post a file?

  30. #30
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    Hit the Manage Attachments button underneath the Reply box (Go Advanced, can't do it with a quick reply), find the target file, and hit Upload.

  31. #31

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    here it is
    Attached Files Attached Files

  32. #32
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    File missing.

    Attach the .frm(Form) file (no need to zip it).

  33. #33
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    The .vbp is just a database of what the project contains. We need the forms, modules, etc. that actually comprise the project.

  34. #34

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    89

    Re: i need help with this program i have no clue what to do

    oops here ya go
    Attached Files Attached Files

  35. #35
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Those TextBoxes are in a Contrrol Array and require a Index! thats all

  36. #36
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    You're right, you did need help... and there's a good reason it won't work.

    You have txtSales and txtCost as members of a control array. I'm guessing you made one text box, then copy-pasted the others to keep the size. Unfortunately, you kept the name, which made them an array, then you changed the name but they kept their status as members of an array. Delete them, make new text boxes, and don't copy-paste them. Just resize them all to where you need them, and give them the right names.

    Secondly, you don't have a lblCommision. You have a lblCom. If you try to use a name that's not assigned to an object, you'll get errors since the object doesn't exist.

  37. #37
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Control Arrays are handy, however in this case you may want to add a new set of 3 TextBox's
    correctly named, but dont select yes when prompted to make a Control Array when 'pasting' the TextBox's.

  38. #38
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    And if you want percentages, it needs to be multiplied by .2 instead of 20. See this form. I think it's what you're looking for.
    Last edited by timeshifter; Mar 23rd, 2007 at 09:33 AM.

  39. #39
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: i need help with this program i have no clue what to do

    Attached:
    Attached Files Attached Files

  40. #40
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: i need help with this program i have no clue what to do

    Is there an echo in here?

Page 1 of 2 12 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