hi people i hope you guys can help with this problem. first, i have two variables(line,star) and i have create a loop that prints out asterisks. my mission is to get these programs to work, and so far i have the richtextbox and 2 buttons that say clear and other that say loop 1. now the problem is that i have trouble writing the code to make this works. so far i got this
Dim Line, Star As Integer For Line = 10 To 1 Step -1 For Star = 10 To Line Step -1RichTextBox1.AppendText(Str(Line) +
" * ") Next StarRichTextBox1.AppendText(vbCrLf)
Next Linebut i supposed to get this answer
***
**
*
but what i got is different from that. so i was wondering if can help me out.

Help
tblanck
ssambi
http://imagebin.org/6715
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Line As Integer = 0
Dim Stars As Integer = 0
For currentLine As Integer = Line To 10
For currentStar As Integer = 0 To Stars Step -1
TextBox1.AppendText("*")
Next
TextBox1.AppendText(Environment.NewLine)
Stars = Stars - 1
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Line As Integer = 10
Dim Stars As Integer = 10
For currentLine As Integer = 0 To Line
For currentStar As Integer = Stars To 0 Step -1
TextBox1.AppendText("*")
Next
TextBox1.AppendText(Environment.NewLine)
Stars = Stars - 1
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim Line As Integer = 10
Dim Stars As Integer = 10
Dim Spaces As Integer = -1
For currentLine As Integer = 0 To Line
For currentSpaces As Integer = Spaces To 0 Step -1
TextBox1.AppendText(" ")
Next
For currentStar As Integer = Stars To 0 Step -1
TextBox1.AppendText("*")
Next
TextBox1.AppendText(Environment.NewLine)
Stars = Stars - 1
Spaces = Spaces + 1
Next
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim Line As Integer = 10
Dim Stars As Integer = 0
Dim Spaces As Integer = 9
For currentLine As Integer = 0 To Line
For currentSpaces As Integer = 0 To Spaces Step +1
TextBox1.AppendText(" ")
Next
For currentStar As Integer = 0 To Stars Step +1
TextBox1.AppendText("*")
Next
TextBox1.AppendText(Environment.NewLine)
Stars = Stars + 1
Spaces = Spaces - 1
Next
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Clear()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.Close()
End Sub
End Class
boombastic
now trying to do the same in C# atm
VinceG
not sure I quite follow. from your desired output example, you would have 2 loops. in the second loop you would decrease the loop counter by one until no more left...
Dim numberOfAstrix as Integer = 3 'to start with
for outerCounter as integer = 0 to 3
for innerCounter as Integer = 0 to numberOfAstrix
Me.theRichTextBox.AppendText("*")
next
numberOfAstrix = numberOfAstrix - 1
Me.theRichTextBox.AppendText(Environment.NewLine)
next
Arran Siu
Inside a RichTextBox. This line controls how many times the inner loop prints out asterisks. my mission is to get these programs to work. Also, if you can, rewrite the triangle program to print out a triangle in 3 different patterns: 1 to 10 on each pattern.
**********
*********
********
*******
******
*****
****
***
**
* and...
__*
_**
***
and...
***
_**
__*
Kamen
please somebody help me out
Amanda Jamin
Sounds like a homework questions - didnt we have two almost identical questions last week on this one.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=967621&SiteID=1