CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: for next loop

  1. #1
    Join Date
    Mar 2001
    Posts
    22

    for next loop

    I'm new at this so please bare with me. I'm trying to create a program that when a button is clicked an angle will print out such as.
    *
    **
    ***
    ****
    *****
    and so on. I'm using for/next loops but can't seem to get it to print out right.
    It's printing out like ******. Any suggestions?


  2. #2
    Join Date
    Jun 2001
    Location
    Sri Lanka
    Posts
    272

    Re: for next loop

    Try this

    Dim i as Integer
    Dim s as string
    s = ""
    for i = 0 to 5
    s = s + "*"
    Debug.print s
    next i





    If u don't know how to Rate an answer, then Rate my answer to learn, If u know, then practice it

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: for next loop


    for T=1 to 5
    Debug.print Replace(Space(t)," ","*")
    next T




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: for next loop

    My two cents worth

    private Sub Command1_Click()
    Dim x
    for x = 1 to 5
    Debug.print string(x, "*")
    next x
    End Sub




    John G

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

Featured