trick to populate with decimal

Discussion in 'ASP .Net' started by Vinnie, Sep 25, 2007.

  1. Vinnie

    Vinnie Guest

    When i try populate a dropdownlist menu using a for cycle i get a
    list of integers from ( in example ) 1 to 10. How can populate the
    same list, if working on the code (C#) i wish to get not longer a
    series of integers, but a series of decimals?

    Like this:
    old list: (for i=1; i<=100; i++) i get 100 integers;

    New list) i want to populate the same list, but using the decimals:
    1.00; 1.01; 1.02; 1.03.... 99.99, 100.00

    Is it possible?

    Any suggestion?
     
    Vinnie, Sep 25, 2007
    #1
    1. Advertising

  2. "Vinnie" <> wrote in message
    news:...

    > Is it possible?


    Yes.

    > Any suggestion?


    i.ToString("0.00");



    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Sep 25, 2007
    #2
    1. Advertising

  3. On Sep 25, 10:51 pm, Vinnie <> wrote:
    > When i try populate a dropdownlist menu using a for cycle i get a
    > list of integers from ( in example ) 1 to 10. How can populate the
    > same list, if working on the code (C#) i wish to get not longer a
    > series of integers, but a series of decimals?
    >
    > Like this:
    > old list: (for i=1; i<=100; i++) i get 100 integers;
    >
    > New list) i want to populate the same list, but using the decimals:
    > 1.00; 1.01; 1.02; 1.03.... 99.99, 100.00
    >
    > Is it possible?
    >
    > Any suggestion?


    for (float i = 1.00F; i <= 100; i=i+.01F) {
    ....
     
    Alexey Smirnov, Sep 25, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ven
    Replies:
    3
    Views:
    1,343
  2. Gilbert Fine
    Replies:
    8
    Views:
    918
    Zentrader
    Aug 1, 2007
  3. Vitaliy
    Replies:
    1
    Views:
    488
    Peter Otten
    May 29, 2008
  4. valpa
    Replies:
    11
    Views:
    1,551
    Steven D'Aprano
    Mar 24, 2009
  5. Enjoy Life
    Replies:
    2
    Views:
    293
    Roland Hall
    Feb 23, 2005
Loading...

Share This Page