locked
hi, there is some problems with formatting string RRS feed

  • Question

  •  

    Dim s As String

    Dim i As Integer

    For i = 1 To 10

    s = Format(i.ToString, "000")

    text1.Text = text1.Text & vbNewLine & s

    Next i

     

    the wanted result is

    001

    002

    003

    004

    005

    ....etc

     

    but the result is

     

    000

    000

    000

    000

     

    there is no 001,002,003

    what is this problem

    in vb6 no problem with this

    Wednesday, November 29, 2006 10:25 PM

Answers

  • try to do padding and see if that helps:

    s = theString.PadLeft(3, "0")

    Wednesday, November 29, 2006 10:47 PM

All replies

  • try to do padding and see if that helps:

    s = theString.PadLeft(3, "0")

    Wednesday, November 29, 2006 10:47 PM
  • Thank you It is very short code AND WAS HELPFUL
    Thursday, November 30, 2006 7:40 AM