Private Sub lsttriangle_KeyPress(KeyAscii As Integer)
Dim n As Integer 'Number of rows
Dim i As Integer 'Counter
n = Val(InputBox("Enter number of rows"))
For i = 1 To n
lsttriangle.AddItem String(i, Asc(i))
Next i
End Sub
15-02-2008 at 12:40 PM
|
JLRodgers Level: Moderator Registered: 04-04-2002 Posts: 1632
Re: numbers in triangular form
Private Sub lsttriangle_KeyPress(KeyAscii As Integer)
Dim n As Integer 'Number of rows
Dim i As Integer 'Counter
Dim output as String
n = Val(InputBox("Enter number of rows"))
output = ""
For iLine = 1 to n
For i = iLine To 1 step -1 'may need to just add the 1
output = output & chr(i)
Next
lsttriangle.AddItem output
Next
End Sub
____________________________ Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)
15-02-2008 at 02:06 PM
|
stickleprojects Level: Moderator Registered: 09-09-2002 Posts: 1007
Re: numbers in triangular form
Hi
Minor modification to get the text right-aligned: