13,142,182 members (52,536 online)
Rate this:
See more:
```  Dim i, j As Integer

TextBox1.TextAlign = HorizontalAlignment.Center
Do While i < 1

i = i - 1

j = 1
Do While j < i - 1
TextBox1.Text = TextBox1.Text & " *"
Loop
TextBox1.Text = TextBox1.Text & vbCrLf
Loop

End Sub```

need out put: inverted pyramid
S*****
S****
SS***
SS**
SS*

help tnx :)
Posted 9-Dec-12 21:29pm
Zaf Khan 10-Dec-12 23:23pm

With reference to Solution 1...
If i is intially set to a value of more than 0 (zero) then the program will not enter the main loop because the statement...
<pre>
Do while i < 1
</pre>
is ALWAYS going to be FALSE
so you will NEVER reach the statement
<pre>
i = i - 1
</pre>

Rate this:

## Solution 2

It seems to me that the integer i should increase instead of decrease, and you would need to set a value for it at the start. (if you the output to look like what you said)
Uhm. No, it should decrease but the While condition was off, I think

```Dim i, j As Integer

TextBox1.TextAlign = HorizontalAlignment.Center
'' clear the TextBox1.Text before you fill it with the *'s
TextBox1.Text = ""
'' Set the amount of *'s you want the first line to contain
i = 7
Do While i > 1

j = 1
Do While j < i
TextBox1.Text = TextBox1.Text & "*"
j = j + 1
Loop
TextBox1.Text = TextBox1.Text & vbCrLf

'' I would decrease i here, and not before the j-loop so that i indicates the amount of *'s in each line correctly
i = i - 1
Loop

End Sub```

I'd try it like that, hope this helped!

P.S. Don't forget the TextBox1.Multiline = True . I know I would lol
also, if something still goes wrong please tell us what error message you're getting/whatever.

Another Edit: if you want the first line to have 5 *'s, you will want to set i to 5, not 7 as I did
v3
Rate this:

## Solution 1

You need to start with an initial i value - in this case `i=6`.
lance12345 10-Dec-12 3:39am

... still doesn't work

Top Experts
Last 24hrsThis month
 OriginalGriff 230 Jochen Arndt 165 ppolymorphe 90 Karthik Bangalore 60 SerenityNowDev 60
 OriginalGriff 5,132 Graeme_Grant 5,028 ppolymorphe 1,834 Jochen Arndt 1,724 CPallini 1,500