Results 1 to 4 of 4

Thread: Percentages...

  1. #1

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up Percentages...

    I have a text box called Text1 and a combobox called Combo1 and there are 10 items in it as follows and user can also manually enter the whatever they need...they can enter 149% instead of using 150%...

    For example...

    1
    1.25
    1.5
    1.75
    2
    100%
    125%
    150%
    175%
    200%

    now the problem is I need to multiply what ever user enters in combo box with the number in Text box...

    For example Text1.Text = 100 and if user chooses 1.5 then the answer will be 150 and if the user choose 150% then the answer will be 150...however if the user chooses 149% then the answer will be 149 and same user can just enter 1.49 to get the answer 149...

    I hope that I explained it proper enough to understand...

    Cheers...

  2. #2
    khalik
    Guest
    Code:
    MsgBox (Text1 * Val(Combo1 )) / 100

  3. #3

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    hmmm...

    ThX Khalik but if the user chooses 1.5 in combobox then it just gives 1.5 instead of 150 and the percentage is fine it gives 150...

    Basically I need a way to figure if the user has entered a pure number or a number with the % at the end of it...

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    if right(combo1.text,1) = "%" then
    MsgBox (Text1 * Val(Combo1 )) / 100
    else
    MsgBox (Text1 * Val(Combo1 ))
    end if
    Remember, if someone's post was not helpful, you can always rate their post negatively .

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