Results 1 to 4 of 4

Thread: Need some help with a project

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    2

    Need some help with a project

    Hey guys, I need help doing a project, and I can't seem to get this one right. I was wondering if someone could guide me through the steps so I can complete it?

    The form looks like this:


    And needs to calculate prices, with labels being the output like this:


    And here is a table of how the prices should be:

    Quantity | | Price per widget
    1 - 10 | | $20.00
    11 - 20 | | $18.00
    21 - 30 | | $16.00
    31 + | | $14.00

    My apologies if this doesn't seem like it makes sense, I'm rushing but I will gladly explain for specifics.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Need some help with a project

    You can use Integer.TryParse to convert the user input to an Integer and then a Select Case statement to decide on the price bracket:
    Code:
    Select Case itemCount
        Case Is > 30
            '31 +
        Case Is > 20
            '21 - 30
        Case Is > 10
            '11 - 20
        Case Else
            '0 - 10
    End Select
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    2

    Re: Need some help with a project

    I tried using Integer.TryParse, but it only resulted in an error.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Need some help with a project

    Quote Originally Posted by Kaio View Post
    I tried using Integer.TryParse, but it only resulted in an error.
    Then you did it wrong. We're not going to know what you did wrong by ESP though. You have to tell us what you did and what happened when you did it. Assume that we know nothing about your project other than what you tell us, which is exactly the case.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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