Click here to Skip to main content
15,888,195 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim i, j, n As Integer
       n = 5
       i = 1
       TextBox1.TextAlign = HorizontalAlignment.Right
       Do Until i >= n
           i += 1
           j = 1
           Do Until j >= i
               TextBox1.Text = TextBox1.Text & " *"
               j += 1
           Loop
           TextBox1.Text = TextBox1.Text & vbCrLf
       Loop

output:
*
**
***
****
*****

question: How to invert this??..
Posted

1 solution

Try:
VB
Dim sb As New StringBuilder()
For i As Integer = 5 To 1 Step -1
	For j As Integer = 0 To i - 1
		sb.Append(" *")
	Next
	sb.Append(vbCr & vbLf)
Next
TextBox1.Text = sb.ToString()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900