Here is a small code to write a multiplication table.
For i1 As Integer = 1 To 20
Console.WriteLine(i1.ToString & " x 12 = " & (i1 * 12).ToString)
Next i1
Have you ever thought it would be better to have it properly aligned. Then use the Padding options (PadeLeft here) to format the output
Private Sub WritePaddedText()
' Write a Padded Multiplication Table
For i1 As Integer = 1 To 20
Console.WriteLine(i1.ToString.PadLeft(2) & " x 12 = " & (i1 * 12).ToString.PadLeft(3))
Next i1
End Sub
See also :How to Create Equispaced Text File using VBA; Spacing in Text Files


No comments:
Post a Comment