PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
count 00 to 52-VBForums
Results 1 to 6 of 6

Thread: count 00 to 52

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    546

    count 00 to 52

    Can easily count 0 to 52 but how would i do it

    00
    01
    02
    03
    etc
    10
    11
    12
    13
    etc
    50
    51
    52

  2. #2
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: count 00 to 52

    how about a simple "for" loop ?

    VB.NET Code:
    1. For i as integer = 0 to 52
    2. 'do whatever you need here
    3. Next i
    Alex
    .NET developer
    "No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)

    Things to consider before posting.
    Don't forget to rate the posts if they helped and mark thread as resolved when they are.


    .Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
    My fresh new blog : writingthecode, even if I don't post much.

    System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0

  3. #3
    Hyperactive Member Jenova's Avatar
    Join Date
    Feb 2006
    Location
    Googleplex
    Posts
    413

    Re: count 00 to 52

    You would use a for loop to achieve this.

    Code:
    Dim iCount As Integer
    
    For iCount = 0 to 52
       MsgBox(iCount)
    Next iCount

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    546

    Re: count 00 to 52

    Thanks for the reply. But thats not what i'm after. I can easily use a for loop for 0 to 52

    I have 52 files Name00, Name02, Name03 up to Name52

    I need to add all these to a list of string. No way going to type all 52. So hence is there an easy way to count from 00 to 52

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: count 00 to 52

    You can use the format parameter of the ToString() method to achieve what you are looking for:

    Code:
            For i As Integer = 0 To 52
                Debug.WriteLine(i.ToString("D2"))
            Next
    Note that the 2 in "D2" indicates it should be padded to a length of 2.

    Here is a good list of standard numeric formats: http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx
    Last edited by Negative0; Dec 21st, 2010 at 01:19 PM. Reason: added URL for clarification.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    546

    Re: count 00 to 52

    Perfect. Just what i was looking for.

    Bookmarked that page

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